Hi Everyone.
I have a data like..
Data new;
Input visit $ stats$ ;
cards;
baseline n
baseline mean
baseline sd
baseline min
visit1 n
visit1 mean
visit1 sd
visit1 min
visit2 n
visit2 mean
visit2 sd
visit2 min
;
run;
I want to add one extra row and want some changes like visit and stats should comes under a single variable as shown in below .
My output should like..
  new                          visit        stats
Baseline analysis
n                                baseline   n
mean                         baseline   mean
sd                              baseline   sd
min                            baseline   min
Analysis at visit1
n                                visit1        n
mean                         visit1        mean
sd                              visit1        sd
min                            visit1        min
Analysis at visit2
n                               visit2         n
mean                        visit2         mean
sd                              visit2        sd
min                            visit2        min
Could anyone help me out how to get it.. Please ignore any spelling mistakes and alignment. I typed in mobile
Thank you
What content in the data set tells us where to insert rows? Rules for the content of the "row".
What specific variable is to contain that text? How long is that variable defined to be? If you try to stick more than 8 letters into a variable defined as length 8 it just won't fit.
And lastly, how do you expect to use this data set? Inserting random text often is not the way to work in SAS and combining multiple values into a single variable is quite often very much harder to do anything with.
No, your input data set is set up fine for PROC REPORT, however if you want more help beyond just use PROC REPORT I would suggest posting actual data.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.
