Hello,
I wrote a SAS code to import a raw file which looks something like the attached snapshot in the end
data WORK.UPCS_FILE ;
infile 'temp_all.upcs' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=3 ;
input xab 1-6
UPC 9-20
UPC_Desc$ 22-51
size$ 52-64
MUP 67-69
date 70-76
storeweeks 78-87
caus_sw 88-92
median_price 93-99;
run;. The output data looks perfectly alright except the fact that the last column (median price) comes out blank for quite a few observations. e.g below
| xab | UPC | UPC_Desc | size | MUP | date | storeweeks | caus_sw | median_price |
| 1 | 1724 | '99' 1.0 LTR | 1.000 LTR | 12 | 0 | 129 | 0 | |
| 2 | 4091 | '99' 1.0 LTR | 1.000 LTR | 12 | 0 | 78 | 0 | |
| 3 | 1586 | '99' LIGHT 1.0 LTR | 1.000 LTR | 12 | 0 | 76 | 0 | |
| 4 | 4024 | '99' LIGHT 1.0 LTR | 1.000 LTR | 12 | 0 | 38 | 0 | |
| 5 | 44872 | 1 BARREL RUM 1.0 LTR | 1.000 LTR | 12 | 0 | 7 | 0 | |
| 6 | 27148 | 1 BARREL RUM 750 ML | 750.000 ML | 12 | 0 | 123 | 0 |
I am also attaching a snapshot of raw data. I can't copy paste the raw data here because it looses format.
I shortened the lenght of last variable and seems to be doing the right thing now
Just as a thought: Try TRUNCOVER instead of MISSOVER
"I am also attaching a snapshot of raw data. I can't copy paste the raw data here because it looses format."
Use the {i} icon and copy or data into the window that pops up or even better directly attach your raw data as a text file (Attachments / Chose Files)
thanks a lot for looking into it
I shortened the lenght of last variable and seems to be doing the right thing now
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.