<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: PROC SURVEYSELECT syntax errors in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-SURVEYSELECT-syntax-errors/m-p/410726#M21474</link>
    <description>&lt;P&gt;I tried it and had not worked.&amp;nbsp; I went back to basics using the SASHELP data and got it to work.&amp;nbsp; That should help me find out what is going on.&amp;nbsp; Just sharing that code.&amp;nbsp; Once I figure it out, I'll share it.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Mybweight;
	set sashelp.bweight;
run;

proc sort Data=Mybweight;
	by MomEdLevel;
run;

proc boxplot data = Mybweight;
   plot Weight * MomEdLevel;
run;

/* create a set for strata totals for surveymeans */
data strattot;
   input MomEdLevel  _total_;
   cards;   /* indicates that datalines follow */
0 17449
1 12129
2 12449
3 7973
;

proc surveymeans data=Mybweight total = strattot nobs mean sum clm clsum ; 
   stratum MomEdLevel ;
   var Weight ;
run;

proc surveyselect data=mybweight out=srssamplebwt method=srs n=100 ;
run;

proc surveyselect data=mybweight out=propsamplebwt method=srs samprate=(0.4,0.25,0.25,0.1) seed=91118;
strata MomEdLevel;
run;

proc print data=propsamplebwt(obs=10);
run;

proc freq data=propsamplebwt;
	TABLES MomEdLevel;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 05 Nov 2017 23:27:47 GMT</pubDate>
    <dc:creator>OldDude</dc:creator>
    <dc:date>2017-11-05T23:27:47Z</dc:date>
    <item>
      <title>PROC SURVEYSELECT syntax errors</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-SURVEYSELECT-syntax-errors/m-p/410655#M21470</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* recreate error using small data set - ERROR: "STRATUM;" is not a valid name */
Data salestest;
  INPUT Id mos stratum sales;
Datalines;
1 61650 1 50008
2 4106 1 5961
3 46306 1 45934
4 54200 1 59255
5 4303 1 3677
6 88352 2 94847
7 108773 2 146875
8 68071 2 65862
9 105970 2 120426
10 85778 2 72323
11 303422 3 322022
12 303962 3 369277
;
run;

proc print data=salestest;
run;

proc Freq data=salestest;
	table stratum;
run;

proc surveyselect data=salestest
      method=srs n=2
      seed=1953 out=sample1;
run;

proc print data=sample1;
run;

proc surveyselect data=salestest 
method = srs n=10 seed=1953 out=sample2;
strata stratum;
run;
/* Error:  	
The table "WORK.SAMPLE2" cannot be opened because it does not contain any columns.
*/&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Nov 2017 10:36:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-SURVEYSELECT-syntax-errors/m-p/410655#M21470</guid>
      <dc:creator>OldDude</dc:creator>
      <dc:date>2017-11-05T10:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SURVEYSELECT syntax errors</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-SURVEYSELECT-syntax-errors/m-p/410664#M21471</link>
      <description>&lt;P&gt;You raised N to 10, which requires 10 observations per stratum.&amp;nbsp; Evidently your data set doesn't contain that many.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Nov 2017 12:04:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-SURVEYSELECT-syntax-errors/m-p/410664#M21471</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-11-05T12:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SURVEYSELECT syntax errors</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-SURVEYSELECT-syntax-errors/m-p/410666#M21472</link>
      <description>&lt;P&gt;Thanks for catching that.&amp;nbsp; That did reproduce the error I am facing with the large data file I am working with.&lt;/P&gt;&lt;P&gt;I am trying to understand the strata statement.&amp;nbsp; If I can run proc frequency using the column name why does it not work with the strata statement as the documentation suggests it should.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title 'Simple Random Sampling';
proc surveyselect data=industry2
      method=srs n=15
      seed=1953 out=nostratasample;
run;
/*above code works on data read from a file */

proc Freq data=industry2;
	table stratum;
run;
/*code above produced output that showed 10 blank rows but had 373 rows in 5 strata */

title 'Stratified Sampling equal allocation';
proc surveyselect data=industry2 
method = srs n=10 seed=1953 out=propsample;
strata stratum;
run;
/* code shown above produces the error reproduced in the small sample*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 05 Nov 2017 12:44:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-SURVEYSELECT-syntax-errors/m-p/410666#M21472</guid>
      <dc:creator>OldDude</dc:creator>
      <dc:date>2017-11-05T12:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SURVEYSELECT syntax errors</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-SURVEYSELECT-syntax-errors/m-p/410721#M21473</link>
      <description>&lt;P&gt;Try sorting the data by stratum before calling proc surveyselect.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Nov 2017 21:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-SURVEYSELECT-syntax-errors/m-p/410721#M21473</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-11-05T21:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SURVEYSELECT syntax errors</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-SURVEYSELECT-syntax-errors/m-p/410726#M21474</link>
      <description>&lt;P&gt;I tried it and had not worked.&amp;nbsp; I went back to basics using the SASHELP data and got it to work.&amp;nbsp; That should help me find out what is going on.&amp;nbsp; Just sharing that code.&amp;nbsp; Once I figure it out, I'll share it.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Mybweight;
	set sashelp.bweight;
run;

proc sort Data=Mybweight;
	by MomEdLevel;
run;

proc boxplot data = Mybweight;
   plot Weight * MomEdLevel;
run;

/* create a set for strata totals for surveymeans */
data strattot;
   input MomEdLevel  _total_;
   cards;   /* indicates that datalines follow */
0 17449
1 12129
2 12449
3 7973
;

proc surveymeans data=Mybweight total = strattot nobs mean sum clm clsum ; 
   stratum MomEdLevel ;
   var Weight ;
run;

proc surveyselect data=mybweight out=srssamplebwt method=srs n=100 ;
run;

proc surveyselect data=mybweight out=propsamplebwt method=srs samprate=(0.4,0.25,0.25,0.1) seed=91118;
strata MomEdLevel;
run;

proc print data=propsamplebwt(obs=10);
run;

proc freq data=propsamplebwt;
	TABLES MomEdLevel;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 05 Nov 2017 23:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-SURVEYSELECT-syntax-errors/m-p/410726#M21474</guid>
      <dc:creator>OldDude</dc:creator>
      <dc:date>2017-11-05T23:27:47Z</dc:date>
    </item>
  </channel>
</rss>

