Hi, guys
I'm struggling in print my new value (Mileage, Cost), but unfortunately it still did not work even I used commax and dollarx.
The result is (.), and I'm not sure what I'm missing. I use sas university edition.
Need help
data usedcar;
infile "/folders/myshortcuts/SASUniversityEdition/module 3/usedcars.txt"
firstobs=2 expandtabs obs=50 dsd
;
input
Year $2. Manufacturer $16. Model $16. Mileage commax. cost dollarx.
;
proc
contents data = usedcar varnum;
Proc
Format;
value Mileage low - 50000 = '<50,000'
50000 - high = '>=50,000'
other = 'Unknown';
Value Cost low - 5000 = 'Economic'
5000-10000 = 'Moderate'
other = 'Expensive';
Proc
print;
run;
Here is my log
You have defined the format but not used it.
You can for example add a format statement to the proc print.
Your first datastep won't run as expected, Some of your infile options are throwing off the results and some of your informats are wrong. I think that you'll find the following to work a lot better:
data usedcar;
infile "/folders/myshortcuts/SASUniversityEdition/module 3/usedcars.txt"
firstobs=2 obs=50 ;
informat year $2.;
informat Manufacturer $16.;
informat Model $16.;
informat Mileage comma10.;
informat cost dollar7.;
input Year Manufacturer Model Mileage cost;
run;
Art, CEO, AnalystFinder.com
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 save with the early bird rate—just $795!
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.