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

Copy the raw data below into a SAS program.   Using proc print, display the data so that all the Amount values are formatted like the Amount value in the first observation of the raw data.  b) Then, revise the data step so that a format for Amount is stored with the data set, and show the results in proc print, without using any format statement in proc print.  Use appropriate titles that identify which part of the exercise the output comes from.

12244 $1,499.99 144

32189 $20,000 1

92314 49.28 3


What type of format and informat should be used to get the output of the 2nd variable as the first observat format.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Does this look like what you want?  

data junk;

input var1 amount var3;

informat amount dollar10.;

format amount dollar10.2;

cards;

12244 $1,499.99 144

32189 $20,000 1

92314 49.28 3

;

run;

View solution in original post

2 REPLIES 2
ballardw
Super User

Does this look like what you want?  

data junk;

input var1 amount var3;

informat amount dollar10.;

format amount dollar10.2;

cards;

12244 $1,499.99 144

32189 $20,000 1

92314 49.28 3

;

run;

lekha
Calcite | Level 5

Thank you so much. I did use this format syntax but didn't work for me. I used the informat syntax in the input statement, may be that's what gave me errors.

sas-innovate-2024.png

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.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 338 views
  • 0 likes
  • 2 in conversation