BookmarkSubscribeRSS Feed
eric61
Calcite | Level 5

I'm trying to create a plot of point estimates and confidence bars for column percentages in a two-way table from SURVEYFREQ. The plots created in the WTFREQPLOT option are for the overall percentages, not the column percentages. How do I create such a plot with the column percentages?  I'm using SAS 9.4 TS level 1M3.  This is what my code looks like now--the plots aren't giving me what I want:

 

proc surveyfreq data=analysisdata;

strata strat;

cluster clus;

table

x*y/col plots=wtfreqplot(type=dot scale=percent groupby=row) chisq;

weight analwt;

run;

3 REPLIES 3
ballardw
Super User

I think that  you  may have to either share some data or use a data set supplied by SAS in the SASHELP library and the code for using that data. Then we can see what the output looks like.

Then describe what you don't want or do want in terms of that output.

 

Or post a copy of your output to discuss. Us the Camera Icon from the menu at the top of the message window.

 

Telling us "the plots aren't giving me what I want" does not actually tell us what you do want.

 

And often the desired graph may require creating an output data set from a procedure and graphing that. The graphs from the Plot statements aren't necessarily intended to be publication ready but more exploratory in nature.

eric61
Calcite | Level 5

OK sorry.  The tabular output is shown below. I tried to include it as an attachment but kept getting an error "the contents of the attachment doesn't match its file type."  Anyway, in the output, the overall percentages are 19.8%, 50.6%, 11.1%, 7.8%, 7.5% and 3.3%.  This is what is plotted in the graphics plot (I couldn't attach that either).  However, the column percentages are 71.8%, 87.1%, 77.2%, 28.2%, 12.9%, and 22.8%. These are the values that I want plotted.

 

 

                                                      example for SAS help                   11:33 Friday, November 15, 2019   1

                                                    The SURVEYFREQ Procedure

                                                          Data Summary

                                              Number of Strata                      3
                                              Number of Clusters                 83
                                              Number of Observations     4002
                                              Sum of Weights        12895570.8


                                                                           Table of x by y

                                                                                     Std Err of     Column      Std Err of
                            x        y     Frequency    Percent        Percent       Percent      Col Percent
                        ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
                            1        1            975       19.7879        1.0989         71.8134      2.0077
                                      2          1394       50.6320        1.2740         87.1180      1.1292
                                      3            542       11.0531        0.6617         77.1514      2.1238

                                 Total         2911       81.4730        0.9082
                        -------------------------------------------------------------------------------
                            2        1            577         7.7667        0.5544         28.1866      2.0077
                                      2            275         7.4869        0.6557         12.8820      1.1292
                                      3            239         3.2734        0.3383         22.8486      2.1238

                                 Total         1091       18.5270        0.9082
                        -------------------------------------------------------------------------------

 

ballardw
Super User

I think you may have to create an output data set and send the results to a graphing procedure such as SGPLOT to have more control.

 

The message you got about "contents of the attachment doesn't match its file type" means that you may have done something to mismatch things.

If you generate output in the text output window then 1) copy the text from the output window and in the forum open a code box by clicking on the {I} icon and paste text into the opened box.

 

Images you should be able to post by clicking the 'Photos' icon , navigating to wherever the output you create resides and dragging or selecting the image file created, hopefully a PNG file.

 

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 599 views
  • 0 likes
  • 2 in conversation