@tarheel13 wrote:
I think this is already resolved as the link I posted explained the problem with SAS studio. I got the data step to work correctly already.
Ok. The link from SAS is a little confused. It says the way to deal with the tabs in the data lines is to modify your code to use TAB as the delimiter instead of space. That might work for this example where all of the spaces between the fields were actually tab characters, but will fail for most other cases where the tabs have replaced only some of the spaces between the fields. If you did need to deal with tabs in the datalines then use the EXPANDTABS option of the INFILE statement instead of the suggestion in that post to modify the delimiter used to scan the datalines.
The best solution is to NOT put tabs into the file to begin with. If you set the option to convert tabs into spaces then when you paste the text with tabs you don't end up with tabs in the file.
And if the original posted had used that option then the file they pasted into their question would not have had tabs either.
Plus you get the added advantage of not having tabs inserted into the program code either. Tabs in program code are just an opportunity for creating extremely confusing looking code.
Check the documentation
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/n1jkqnmk6y6ms9n1b2vvubyzqd4a.htm
Note: | The SERIES statement plots data in data order. For this reason, the input data set should be sorted by the X variable. Otherwise, unexpected results might occur. |
---|
Sorry, I forgot to mention but my dataset dat2 is sorted by visit so I'm not sure why those visits for ID#011 are not showing up in the order they're supposed to. I couldn't find anything concrete in the documentation about how to get the x-axis to display all 4 visits for all participants though, or if there might be any better plot/way to visualize change in status over time by ID
What values do you expect to display for the ones that you did not provide???
Fill in the holes in your series and then plot that version of the data.
proc sql ;
create table skeleton as
select *
from (select distinct id from dat) a
, (select distinct visit from dat) b
;
quit;
data dat2;
merge skeleton dat;
by id visit;
run;
proc sgpanel data=dat2;
panelby id/ uniscale=row;
series x=visit y=status / markers
markerattrs=(size=10pt);
run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.