Tutorial by Examples

The format statement applies the given format to the specified variable for display purposes only, i.e. the underlying value does not change. data example1 ; Date = '02AUG2016'd ; /* stored as a SAS date, i.e. a number */ Date2 = '31AUG2016'd ; format Date monyy7. Date2 yymmddn8. ; run...
You can apply formats within a procedure, e.g. to change the groupings within a proc summary or proc freq. Grouping SAS dates data example2 ; do Date = '01JUN2016'dt to '31AUG2016'dt ; Days = 1 ; output ; end ; run ; /* Summarise by year & month */ proc summary data=exampl...
Custom formats, also known as user defined formats, can be created and used like any other default formats. /*Create new character format for state variables*/ PROC FORMAT; VALUE $statef 'CA' = 'California' 'MA' = 'Massachusetts' 'NY' = 'New York'; ...
Informats are used to tell SAS how to read in the data and are identified with an informat statement. data test; infile test.csv; informat id $6. date mmddyy10. cost comma10.2 ; input @1 id @7 date @20 cost ; run; Informats and Format...

Page 1 of 1