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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.