BookmarkSubscribeRSS Feed
Kevin_Graduate
Calcite | Level 5
Is there any OPTIONS that can control the number of decimal places respectively for the two ways of outptut: 1) PUT, and 2) PROC PRINT? The variable invest has 6 decimal places currently by default.

[pre]
DATA newdata;
SET olddata;
IF idnum=10013 THEN PUT invest= ;
RUN;

PROC PRINT DATA=olddata;
WHERE idnum=10013;
RUN;

[/pre]
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
The answer to your question will be a SAS format for both usage scenarios. The difference is that PROC PRINT will need a FORMAT statement:
[pre]
format invest comma10.2;
[/pre]

While the PUT statement just needs to be told what format to use:
[pre]
PUT invest= comma10.2;
[/pre]

If you used a format statement inside your DATA step program, then WORK.NEWDATA would have the format permanently associated with the INVEST variable. For example, in the program below, the WEIGHT variable in WORK.NEW has the format COMMA10.6 associated with it. So, that format is used by PROC PRINT.

cynthia
[pre]
data new;
set sashelp.class;
format weight comma10.6;
run;

ods listing;
proc print data=work.new;
run;
[/pre]
Kevin_Graduate
Calcite | Level 5
thanks a lot, Cynthia@sas.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 19872 views
  • 0 likes
  • 2 in conversation