BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Giampaolo
Obsidian | Level 7

Hello SAS users,

my data are means from measurements that were taken before surgery and at regular interval after surgery. I would like to connect with a smooth line only the measurement taken after surgery. The means of measurements taken before surgery should have the same symbols as those following surgery but should be separated. Can I do this without juxtaposing 2 separately created graphs?

Thank you!

I posted my code below, although I am not sure that it can offer any further information to this problem. 

proc sgplot data= &VB.overtime3 ;

Title "Perioperative levels of &VB";
styleattrs datacontrastcolors=(blue blue red red ) DATALINEPATTERNS=(solid shortdash solid shortdash  )
datacolors=(blue blue red red) datasymbols=(circlefilled circlefilled squarefilled squarefilled);
xaxis type=discrete;
series x=level y=&VB.mean_lev /smoothconnect
MARKERS markerattrs=(size=9) LINEATTRS = (THICKNESS = 2)group = &G;
keylegend/  valueattrs=(SIZE=12);
xaxis type=discrete;
scatter x=level y=&VB.mean_lev /
markerattrs=(size=0)
yerrorlower=&VB.LCLM_lev 
yerrorupper=&VB.UCLM_lev group = &G;

YAXIS LABEL = "&VB (mg/dl)" valueattrs=(SIZE=12) labelattrs=(SIZE=12 weight=bold) ; 
XAXIS LABEL = 'TIME' valueattrs=(SIZE=12) labelattrs=(SIZE=12 weight=bold); 
format level level.;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

@Giampaolo wrote:

Hello SAS users,

my data are means from measurements that were taken before surgery and at regular interval after surgery. I would like to connect with a smooth line only the measurement taken after surgery. The means of measurements taken before surgery should have the same symbols as those following surgery but should be separated. Can I do this without juxtaposing 2 separately created graphs?

Thank you!

 


Yes you can, but you likely need to modify your data. 

I would probably just create some new variables such that you have two series of data and then use a SCATTER statement for the data before the surgery and SERIES for the data after the surgery date. 

 

Split data into new variables. 

 

data want;
set have;

if date > surgery_date then do;
x=new_x;
y=new_y;
call missing(x,y);
end;

run;

View solution in original post

5 REPLIES 5
data_null__
Jade | Level 19

It may be as simple as having the two groups of data points (before and after) as separate variables plotted with two scatter statements.

 

If you showed some data that would help.

 

Reeza
Super User

@Giampaolo wrote:

Hello SAS users,

my data are means from measurements that were taken before surgery and at regular interval after surgery. I would like to connect with a smooth line only the measurement taken after surgery. The means of measurements taken before surgery should have the same symbols as those following surgery but should be separated. Can I do this without juxtaposing 2 separately created graphs?

Thank you!

 


Yes you can, but you likely need to modify your data. 

I would probably just create some new variables such that you have two series of data and then use a SCATTER statement for the data before the surgery and SERIES for the data after the surgery date. 

 

Split data into new variables. 

 

data want;
set have;

if date > surgery_date then do;
x=new_x;
y=new_y;
call missing(x,y);
end;

run;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 810 views
  • 0 likes
  • 3 in conversation