turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Proc Surveyreg with Plots option

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-17-2014 04:30 PM

Has anyone used Proc Surveyreg with Plots options for graphs? I tried it with ODS graphics on but it didn't work. I also tried LSMEANS statement but SAS told me it is a wrong syntax.

I used SAS 9.3 version. Anyone can help?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to monica1230

01-17-2014 07:31 PM

According to SAS support:

You need to use the **LSMEANS** statement with the **PLOT** option,

like this:

data IceCreamDataDomain;

input Grade Spending Income Gender$ @@;

datalines;

7 7 39 M 7 7 38 F 8 12 47 F

9 10 47 M 7 1 34 M 7 10 43 M

7 3 44 M 8 20 60 F 8 19 57 M

7 2 35 M 7 2 36 F 9 15 51 F

8 16 53 F 7 6 37 F 7 6 41 M

7 6 39 M 9 15 50 M 8 17 57 F

8 14 46 M 9 8 41 M 9 8 41 F

9 7 47 F 7 3 39 F 7 12 50 M

7 4 43 M 9 14 46 F 8 18 58 M

9 9 44 F 7 2 37 F 7 1 37 M

7 4 44 M 7 11 42 M 9 8 41 M

8 10 42 M 8 13 46 F 7 2 40 F

9 6 45 F 9 11 45 M 7 2 36 F

7 9 46 F

;

data StudentTotals;

input Grade _TOTAL_;

datalines;

7 1824

8 1025

9 1151

;

data IceCreamDataDomain;

set IceCreamDataDomain;

if Grade=7 then Prob=20/1824;

if Grade=8 then Prob=9/1025;

if Grade=9 then Prob=11/1151;

Weight=1/Prob;

run;

title1 'Ice Cream Spending Analysis';

title2 'Compare Domain Statistics';

proc surveyreg data=IceCreamDataDomain total=StudentTotals;

strata Grade;

class Gender;

model Spending = Gender / vadjust=none;

**lsmeans** Gender / diff plots=(diff meanplot(cl));

weight Weight;

run;

I hope this helps;

Anca.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to AncaTilea

01-17-2014 09:39 PM

Thank you, Anca! This is exactly what I did based on the SAS User Guide. But it didn't work. SAS log indicated wrong syntax. This is frustrating but I will try to run it again.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to monica1230

01-18-2014 11:23 PM

It would help if you posted the LOG (or some part of it - mainly containing the error) so we can figure out what syntax I wrong.

Anca.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to monica1230

01-21-2014 01:47 PM

I tried to run proc surveyreg with plots option:

**ods graphics on;**

**proc surveyreg plots=fit;**

** model height=weight;**

**run;**

**ods graphics off;**

But I get error, the log indicates as follow:

**3330 ods graphics on;**

**3331 proc surveyreg plots=fit;**

** -----**

** 22**

** 76**

**ERROR 22-322: Syntax error, expecting one of the following: ;, ALPHA, DATA, METHOD, MISSING, N,**

** NOMCAR, ORDER, R, TRUNCATE, VARMETHOD.**

**ERROR 76-322: Syntax error, statement will be ignored.**

**3332 model height=weight;**

Why is SAS didn't have option PLOTS for me? Again, I have SAS 9.3

Thank you

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to monica1230

01-21-2014 02:50 PM

Try using

Proc surveyreg data = yourdata plots =....

Maybe it needs you to specify the data...

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to AncaTilea

01-21-2014 09:05 PM

I specified the dataset name but it still gave me the same error. I am out of ideas

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to monica1230

01-21-2014 09:52 PM

There is no plots= option in the proc surveyreg statement in version 9.3. A fitplot was introduced in version 13, and for models involving a single regressor only (such as yours).

As a workaround, look into the effectplot of proc plm.

PG

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to PGStats

01-22-2014 11:17 AM

Thank you very much for solving the puzzle for me. I will find another way, may be sgplot to graph the fitplot. I am not familiar with proc plm but I will look into it.

YuehYing

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to monica1230

01-22-2014 11:29 AM

If you're using proc surveyreg as noted in your example above I don't believe you need surveyreg, but proc reg will suffice.

If you have a strata, wieght, cluster, contrast or domain statement as well then you probably need surveyreg.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

01-22-2014 11:36 AM

Thank you Reeze. I do need to use surveyreg with strata, cluster, weight and domain statements for analyzing NHANES data.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to monica1230

01-22-2014 11:16 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to AncaTilea

01-22-2014 11:27 AM

Anca, thank you for pointing that out. I did use lsmeans statement with plots option but it did not generate fitplot which what I need.

SAS should revise their 13.1 user guide because here, it says that PLOTS is one of the options available in the proc surveyreg statement.

support.sas.com/documentation/cdl/en/statug/66859/HTML/default/viewer.htm#statug_surveyreg_syntax01.htm