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
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.