a week ago
I have input data that looks like these -
Size Space Date
840K 7% 2017.183
23433K 25% 2013.034
The "K" probably is 1000 or 1024 - I take the value as 1000.
I have not seen any INFORMATS that can convert 840K to 840000 (numeric value) or 7% to 0.07 (numeric value). The date has a "." in between the year and day (in Julian format). I need to convert the date to SAS internal date. Again, I went looking at the INFORMATS available - but, I can't see any suitable ones.
I understand the coding required (for example) -
SIZEN = INPUT (SIZE. informat);
It is trying to look for a proper informat that gives me the problems.
a week ago
data want; infile cards firstobs=2; format size 10. space 7.2 date date9.; input size_string $ space :percent7. date_string :$10.; date = input(compress(date_string,'.'),julian8.); pos = notdigit(trim(size_string)); size = input(substr(size_string,1,pos-1),10.); select (substr(size_string,pos,1)); when ('K') size = size * 1024; end; drop size_string date_string pos; cards; Size Space Date 840K 7% 2017.183 23433K 25% 2013.034 ; run;
You just have to "fit" the data for the proper formats. How eg the input for the JULIANw. format has to look can be taken from the documentation.
The documentation can usually be found by googling "SAS 9.4" and the keyword, or something like "SAS 9.4 informats by category".
Need further help from the community? Please ask a new question.