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

Hi,

 

my proc-report-output has multiple columns and Im looking for the best way, to implement the following format:

 

the column sum should not have any decimal places [numx.]

for the other columns there are some conditions:

if the column "Einheit" = "%", then use for all columns (except col sum) a format with one decimal place [numx.1]

if the column "Einheit" = "1000", then use for all columns (except col sum) a format with no decimal places [numx.]

 

So, is the proc-format a solution? Can I specify these if-statements into the proc-format-statement? Or do I have to implement it into the a proc-report-compute--statement for each column?

Thank you!

 

Data have:

Age Einheit sum 1 2 3 4
1000 506,5 5,865
1000 105,6 4,578
1000 207,68 4,397
% 120,5 1,245
% 88,5 1,895
% 54,187 1,2
...
1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

Can split the dataset into two and create two datasets with all variables as char type with the required format, then merge the two and create the report with char formats.

View solution in original post

4 REPLIES 4
Shmuel
Garnet | Level 18

Can split the dataset into two and create two datasets with all variables as char type with the required format, then merge the two and create the report with char formats.

Konkordanz
Pyrite | Level 9
Thank you for the help!
PeterClemmensen
Tourmaline | Level 20

The short answer is no, this is not a Proc Format issue. The Format Procedure does not know a-priori what the value of another variable is.

Kurt_Bremser
Super User

Numbers like 1,2,3,4 are not valid SAS variable names, so I suspect this is not really your dataset.

Please post an example of your real dataset in a data step with datalines, so we have something to test PROC REPORT code against.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 4 replies
  • 745 views
  • 3 likes
  • 4 in conversation