Hello everyone,
When I want to print all observations under a variable, it prints them in a column format (i.e., each observation is listed right below the previous one). However, how can I print all observations in a row format (i.e., all observations are listed adjasent to each other)?
Any idea/thought is really appreciated!
You'll need to manually use a PUT statement within a data step to control your output.
Or you could select the row, transpose your data and then use PROC PRINT.
If this is something you do regularly I'd probably create a macro to handle this issue.
Show an example starting data set and the desired resulting data set.
Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.
@Alireza_Boloori wrote:
I'd be very thankful if you can create a macro, because this is not going to be a one-time SAS code for me.
I'm happy to help, not to write your code. If this is not a one time use you should also understand it thoroughly. I suggest coding it for a 'Base case' then we can help you turn it into a macro. For example, how to get all Names from SASHELP.CLASS on a single line. You didn't want any delimiter between the values?
See the PUT Statement Documentation for examples
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!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.