date - How to format input for SAS's MONYY format -


i have dataset dates in format "fy15 feb". in attempting format variable use sas's times , dates, i've done following:

data temp;     set pre_temp;     yr = substr(fiscal,3,2);     month = substr(fiscal,6,length(fiscal));     mmmyy = month||yr;     input mmmyy monyy5.;     datalines; run; 

so, have strings representing year , corresponding month. however, running code gives me error "the informat $monyy not found or not loaded." doing background on error tells me has passing informat value wrong type; should alter in order correct output?

*edit: see on sas support page formats "monyyw. expects sas date value input;" given this, how go strings different date format before one?

when see $, means character value. in case, you're feeding sas character value , giving numeric format. sas inserts $ you, there no such format in existence.

i'm going ignore datalines statement, because i'm not sure why it's there (though notice there no set statement). might have easier time changing program to:

data temp;     yr = substr(fiscal,3,2);     month = substr(fiscal,6,length(fiscal));     pre_mmmyy = strip(month)||strip(yr);     mmmyy=input(pre_mmmyy,monyy5.); run; 

you can remove "length(fiscal))" substring function. 3rd argument substring function optional, , go end of string default.


Comments