Published on :
Général SASHELP

Sans titre

This code is also available in: Deutsch Español Français
Awaiting validation
Data Analysis

Type : SASHELP


Data comes from the standard SASHELP.CLASS table.

1 Code Block
DATA STEP Data
Explanation :
Creation of the 'test1' table using a classic IF-THEN/ELSE conditional structure to define the 'price' variable.
Copied!
1DATA test1 ;
2 SET sashelp.class ;
3 * set entry price based on age ;
4 IF age>=13 THEN
5 price=12.50 ;
6 ELSE
7 price=8 ;
8 RUN ;
2 Code Block
DATA STEP Data
Explanation :
Creation of the 'test2' table using the IFN function to concisely define the 'price' variable (if age >= 13, then 12.50, else 8).
Copied!
1DATA test2 ;
2 SET sashelp.class ;
3 * set entry price based on age ;
4 price=ifn(age>=13,12.50,8) ;
5 RUN ;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.