17 data hware inter soft;
18 set company.prices (keep = producttype price);
19 if price le 5.00;
20 if producttype = 'HARDWARE' then output HWARE;
21 else if producttype = 'NETWORK' then output INTER;
22 else if producttype = 'SOFTWARE' then output SOFT;
NOTE: There were 6 observations read from the data set COMPANY.PRICES.
NOTE: The data set WORK.HWARE has 2 observations and 2 variables.
NOTE: The data set WORK.INTER has 0 observations and 2 variables.
NOTE: The data set WORK.SOFT has 1 observations and 2 variables.
NOTE: DATA statement used (Total process time):
real time 0.05 seconds
cpu time 0.03 seconds
The dataset option, keep = producttype price allows only two variables in the output (producttype and price). The statement if price le 5.00; will subset the data and only records where variable price is less than 5.00 (i.e. the second, third and sixth records) will be processed for output. Now the statement if producttype = 'HARDWARE' then output HWARE; will only allow the second and third records to be output.
The one and only FREE resource for general SAS online training as well as study guides for the SAS Base Certification. My goal is to create the SAS Certification prep guide that I never found but always wanted. This should also be a place to come if you are new to the language but are simply looking for online SAS training.