I have a large dataset with dates as columns. Actually the columns are a simulated date (_YYYYMMDD_) stored in a macro variable, but that's a whole other issue. I then print this data by an ID with those dynamic dates. However, some of the data may have data on Monday, Wednesday and Friday whereas other data may have just Monday and Wednesday. Since the macro variable contains all valid days stored for the complete set of data, the IDs that only have Monday and Wednesday will always have that blank column for Friday. I want to only have non-blank columns print on each by group. Is this possible without completely re-writing the way I store the data.
ID _20161102_ _20161104_ _20161107_ _20161109_ _20161111_
1 12 22 33 12 33
2 7 . 22 11 .
When 1 is printed I want it to have all columns, but 2 should only show the days/columnswhen there is data.
You would be better off storing the data in a long format and then reporting using a proc report and Across or proc tabulate.
Let's assume that's not possible for some reason.
Based on your variable list you can compute statistics, and if the NMISS is equal to the total number of observations then you can select those column names for your final report.
There's no simple filter in proc print that I'm aware of.
It's work, but you can do it by using customized reporting (a DATA step with FILE an PUT statements to generate the report). Your DATA step skills will need to be good (including familiarity with arrays plus a firm grasp of what you want the report to look like) to make this happen.
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.