BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Steelersgirl
Calcite | Level 5

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;

 

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

@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;

View solution in original post

3 REPLIES 3
novinosrin
Tourmaline | Level 20
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
;
novinosrin
Tourmaline | Level 20

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;

novinosrin
Tourmaline | Level 20

@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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1120 views
  • 1 like
  • 2 in conversation