Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

abc #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

abc #10

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions STAT660-01_f18-week01_sas_recipes-19AUG2018.sas
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


*******************************************************************************;
* hello_world ;
* hello_world ; abccdef
*******************************************************************************;
/*
Scenario: Printing to the SAS log.
Expand All @@ -14,24 +14,24 @@ Approach: Use a null data step and put statement to write to the log

Recipe <with everything in square brackets to be filled in for actual use>:

data _null_;
put "<message>";
data _null_;
put "<message>";
run;
*/

*Example;
data _null_;
put 'Hello, World!';
data _null_;
put 'Hello, World!';
run;
/*
Notes:
(1) In this example, single-quotes have been used to delimit the string literal
'Hello, World!', meaning we know the string is everything between the opening
and closing single-quote marks. However, the recipe used double-quote marks. In
general, either single-quotes or double-quotes can be used to delimit SAS string
literals, but double-quotes should be used whenever so-called macro variables
are included in string literals, as we'll see later. (For now, just remember
that SAS treats single- and double-quotes differently for something called
(1) In this example, single-quotes have been used to delimit the string literal
'Hello, World!', meaning we know the string is everything between the opening
and closing single-quote marks. However, the recipe used double-quote marks. In
general, either single-quotes or double-quotes can be used to delimit SAS string
literals, but double-quotes should be used whenever so-called macro variables
are included in string literals, as we'll see later. (For now, just remember
that SAS treats single- and double-quotes differently for something called
macros.)
*/

Expand All @@ -46,28 +46,28 @@ Approach: Use a null data step and business logic to write to the log
*/

*Example;
data _null_;
do i = 1 to 100;
if mod(i,3) = 0 then put 'Fizz';
else if mod(i, 5) = 0 then put 'Buzz';
else put i=;
end;
data _null_;
do i = 1 to 100;
if mod(i,3) = 0 then put 'Fizz';
else if mod(i, 5) = 0 then put 'Buzz';
else put i=;
end;
run;
)
/*
Notes:
(1) In this example, the four main components of imperative programming are
used: (1) The variable i is used to hold a value that varies; (2) the mod
function is called with behavior dependent on a variable's current value (e.g.,
mod(i,3) evaluates to 0 if i is divisible by 3, and is 1 otherwise); (3)
conditional statement execution in the form an if-else if-else branching
structure, where only one of the three branches is executed, depending upon
whether i is divisible by 3, by 5, or by neither; and (4) looping in the form of
the do-loop repeating the same block of code (the 3-line if-else if-else
branching structure) 100 times, once for each value of i, which starts with the
value 1 and is incremented by 1 repeatedly.
(2) In general, SAS data steps will use these four components, in addition to
dataset access methods, to prepare/clean data for analysis. This type of
programming is commonly called "business logic" since it encapsulated domain
(1) In this example, the four main components of imperative programming are
used: (1) The variable i is used to hold a value that varies; (2) the mod
function is called with behavior dependent on a variable's current value (e.g.,
mod(i,3) evaluates to 0 if i is divisible by 3, and is 1 otherwise); (3)
conditional statement execution in the form an if-else if-else branching
structure, where only one of the three branches is executed, depending upon
whether i is divisible by 3, by 5, or by neither; and (4) looping in the form of
the do-loop repeating the same block of code (the 3-line if-else if-else
branching structure) 100 times, once for each value of i, which starts with the
value 1 and is incremented by 1 repeatedly.
(2) In general, SAS data steps will use these four components, in addition to
dataset access methods, to prepare/clean data for analysis. This type of
programming is commonly called "business logic" since it encapsulated domain
specific behavior, here to solve a specific programming challenge.
*/
*/