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

data np_summary_update; set pg1.np_summary; keep Reg ParkName DayVisits OtherLodging Acres SqMiles Camping; SqMiles=Acres*.0015625; Camping=sum(OtherCamping,TentCampers, RVCampers,BackcountryCampers); format SqMiles comma6. Camping comma10.; run; data np_summary_update; set pg1.np_summary; keep SqMiles Camping Reg ParkName DayVisits OtherLodging Acres ; *Add assignment statements; SqMiles=Acres *.0015625; Camping =sum(OtherCamping,TentCampers,RVCampers,BackcountryCampers); format SqMiles comma. Camping comma. run;

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

Welcome to the community.

 

Two things to get the best results:

 

1. To make the most of this community, learn how to use the tools.

For example, use the running man icon to post code. Your code is illegible as is.

 

2. To make the most of SAS, always refer to the documentation.

In this case, see https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/p0sad1pg4gsni3n1gbjue9fxzyhq.ht...

You'll see that if you omit to specify the length for this format, a value of 6 is used. Hence the identical displayed values.

 

 

View solution in original post

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

Welcome to the community.

 

Two things to get the best results:

 

1. To make the most of this community, learn how to use the tools.

For example, use the running man icon to post code. Your code is illegible as is.

 

2. To make the most of SAS, always refer to the documentation.

In this case, see https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/p0sad1pg4gsni3n1gbjue9fxzyhq.ht...

You'll see that if you omit to specify the length for this format, a value of 6 is used. Hence the identical displayed values.

 

 

ballardw
Super User

Every SAS supplied format will have the default setting for W, as in Commaw., the displayed width of the result in the format description in the help.

 

 

When you create custom formats with Proc Format you can specify a default display width as well.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

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