I am trying to read the following dataset in to SAS without money signs: http://people.stat.sc.edu/hitchcock/tshirt.txt.
I have been trying the following code and it is not printing values for the shipping costs column and I can't figure out how to get rid of the money signs.
DATA tshirt;
FILENAME webpage URL 'http://people.stat.sc.edu/hitchcock/tshirt.txt';
INFILE webpage;
INPUT size$color$price$shippingcosts;
RUN;
PROC PRINT DATA=tshirt;
@Steelersgirl Take this version plz
data have;
FILENAME webpage URL 'http://people.stat.sc.edu/hitchcock/tshirt.txt';
INFILE webpage;
input size $ color $ /price : comma10. /shippingcosts : comma10.;
format price shippingcosts dollar10.2;
run;
data have;
input size $ color $ /price comma10. /shippingcosts comma10.;
cards;
Large Red
$19.77
$0.35
Medium Green
$25.36
$1.21
X-Large Blue
$29.45
$1.76
Small Yellow
$15.28
$0.92
;
And if you want format the output back to dollar for display, add the format statement with the appropriate format
format price shippingcosts dollar10.2;
@Steelersgirl Take this version plz
data have;
FILENAME webpage URL 'http://people.stat.sc.edu/hitchcock/tshirt.txt';
INFILE webpage;
input size $ color $ /price : comma10. /shippingcosts : comma10.;
format price shippingcosts dollar10.2;
run;
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.