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 | … | … | … | … |
… | … | … | ... | … | … | … | … |
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.
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.
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.
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.