BookmarkSubscribeRSS Feed
SJ12
Calcite | Level 5

Hello,

For one of my analysis at population level, I look at the consumption of a ultra-processed foods (in % of total daily calories) according to length of stay in host country among immigrants (by ethnicity/race)

 

pratio4 =% of total daily calories coming from ultra-processed foods

 

For my procedure, I used a simple linear regression:

 

proc surveyreg data=X varmethod=brr;

weight WTS_M; repweights bsw1-bsw500;

by ethnicity_race;

model pratio4=lengthofstay;

run;

 

I get a graphic that seem to have all individual points in it. Is there a way to get the graphic with only the regression line and not showing the individual values in it?

Thanks!

 

 

4 REPLIES 4
ballardw
Super User

First, you want to read the documentation about use of BY statements in complex sample data. I have to assume since you are using Surveyreg that you have complex sample.

To get proper calculations of variance then you should use a DOMAIN statement instead of BY.

 

I don't see anything requesting plots. So what is creating your graphic?

 

To plot regression lines I would typically use the OUTPUT statement to have the predicted values and possibly the confidence limits of the prediction from the model in a data set then use a procedure like SGPLOT or SGPANEL to use a REG plot with the independent variable the X axis variable and the predicted variable as the Y axis variable. Using the Domain variable as a Group= variable or possibly the Panelby variable in Sgpanel and the NOMARKERS option to suppress the scatter plot of values.

SJ12
Calcite | Level 5

Yes it's complex sample and you're right, I changed in recently to domain instead of ''by''. Ok yes, that's helpful! I'm just wondering the difference between ''ods output'' and just ''output''? 

Thanks!

ballardw
Super User

@SJ12 wrote:

Yes it's complex sample and you're right, I changed in recently to domain instead of ''by''. Ok yes, that's helpful! I'm just wondering the difference between ''ods output'' and just ''output''? 

Thanks!


Good question. ODS OUTPUT creates datasets based on the output sent to results window. Which will generally be summaries or results of analysis.

The output data set in Surveyreg is specifically designed to add predicted and some related values to the incoming data set and create a data set. Typically you would not want to see 1000's of rows of basically Proc Print output in a results document so this is sent to a data set. Then you can do stuff like plot or use the predicted value as input into another analysis step.

One thing this data set can be used for is create dependent variable values (predicted) for values of the independent variables that did not actually have an answer (missing dependent) so you may want to be a bit careful with the predicted. You can get residuals (difference between predicted and actual values) to do custom determination of how well your model fits.

SJ12
Calcite | Level 5

Ok that's been helpful, thanks for your answer! 

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
  • 4 replies
  • 459 views
  • 0 likes
  • 2 in conversation