SAS – SAMPLE PROGRAM
An input file is received from other system and the data available in the file is provided below.
The SAS code provided below will read the input file and produce an output file which has data in the below format.
(Note: COLS provided below is just for your reference)
COBOL 1959 GRACE HOPPER
DB2 1983 EDGAR CODD
CICS 1968 IBM
The main motive was to introduce you to SAS. Even though the primary purpose for SAS is statistical analysis, when we have input data in not an orderly format, we can make use of SAS programming. The below program is just a sample on how we can use SAS, we can do even more with it.
//PS010 EXEC SASMSTRC
//SASINPUT DD DSN=INPUT.SAS.FILE,DISP=SHR
//SASOFILE DD DSN=OUTPUT.SAS.FILE,
//SASLIST DD SYSOUT=*
//SYSIN DD *
*–START OF SAS CNTLCARD —————–
INFILE SASINPUT DSD;
INPUT NAME :$5. YEAR PERSON :$20.;
FILE SASOFILE NOTITLE;
PUT NAME 1-5 YEAR 08-11 PERSON 14-30;
*–END OF SAS CNTLCARD —————–
The option DSD used in the INFILE statement assumes that the delimiter as comma by default.