<?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: sas 9.4 data step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sas-9-4-data-step/m-p/602774#M174556</link>
    <description>Hi:&lt;BR /&gt;  I am surprised that your code works. The correct statement is %LET (no 's' on the end).&lt;BR /&gt;Cynthia</description>
    <pubDate>Fri, 08 Nov 2019 17:01:35 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2019-11-08T17:01:35Z</dc:date>
    <item>
      <title>sas 9.4 data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-9-4-data-step/m-p/602767#M174552</link>
      <description>&lt;P&gt;% lets samplesize = 40;&lt;/P&gt;&lt;P&gt;%lets seed = 12345;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have nobs=tot;&lt;/P&gt;&lt;P&gt;retain;&lt;/P&gt;&lt;P&gt;select = min(&amp;amp;samplesize, tot);&lt;/P&gt;&lt;P&gt;do I = Tot to 1 by -1;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;if ranuni(&amp;amp;seed + (&amp;amp;I - 1)) &amp;lt; select /I then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;select + - 1;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am running this code to randomly select 40 customers from data have and getting following in my log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: Limit set by errors=option reached. further errors of this type will not be printed. mathematical operations could not be performed at the following places. the results of the operators have been set to missing values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is not selecting 40 claims rather giving me everything whatever I have in 'have' data set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2019 16:25:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-9-4-data-step/m-p/602767#M174552</guid>
      <dc:creator>Pooja2</dc:creator>
      <dc:date>2019-11-08T16:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: sas 9.4 data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-9-4-data-step/m-p/602769#M174553</link>
      <description>&lt;P&gt;From where do you get macro variable &amp;amp;i used in this statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if ranuni(&amp;amp;seed + (&amp;amp;I - 1)) &amp;lt; select /I then do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I guess it should be the data step variable i instead?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2019 16:31:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-9-4-data-step/m-p/602769#M174553</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-08T16:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: sas 9.4 data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-9-4-data-step/m-p/602770#M174554</link>
      <description>&lt;P&gt;PS take a look if proc surveyselect would be a better solution.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2019 16:34:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-9-4-data-step/m-p/602770#M174554</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-08T16:34:04Z</dc:date>
    </item>
    <item>
      <title>Re: sas 9.4 data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-9-4-data-step/m-p/602771#M174555</link>
      <description>&lt;P&gt;Seed value I am getting from lets statement and &amp;amp;I value I am getting from a data step;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it is a macro&lt;/P&gt;&lt;P&gt;% lets samplesize = 40;&lt;/P&gt;&lt;P&gt;%lets seed = 12345;&lt;/P&gt;&lt;P&gt;%lets number = 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro want;&lt;/P&gt;&lt;P&gt;do I = 1 %to &amp;amp;number;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have nobs=tot;&lt;/P&gt;&lt;P&gt;retain;&lt;/P&gt;&lt;P&gt;select = min(&amp;amp;samplesize, tot);&lt;/P&gt;&lt;P&gt;do I = Tot to 1 by -1;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;if ranuni(&amp;amp;seed + (&amp;amp;I - 1)) &amp;lt; select /I then do;&lt;/P&gt;&lt;P&gt;select + - 1;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%mend want;&lt;/P&gt;&lt;P&gt;%want;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2019 16:36:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-9-4-data-step/m-p/602771#M174555</guid>
      <dc:creator>Pooja2</dc:creator>
      <dc:date>2019-11-08T16:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: sas 9.4 data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-9-4-data-step/m-p/602774#M174556</link>
      <description>Hi:&lt;BR /&gt;  I am surprised that your code works. The correct statement is %LET (no 's' on the end).&lt;BR /&gt;Cynthia</description>
      <pubDate>Fri, 08 Nov 2019 17:01:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-9-4-data-step/m-p/602774#M174556</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2019-11-08T17:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: sas 9.4 data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-9-4-data-step/m-p/602775#M174557</link>
      <description>&lt;P&gt;Cynthia.&lt;/P&gt;&lt;P&gt;Sorry for that. That's a typo. I am not copying and pasting from my another computer. Sorry about that. There is no 's' in the let statement.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2019 17:04:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-9-4-data-step/m-p/602775#M174557</guid>
      <dc:creator>Pooja2</dc:creator>
      <dc:date>2019-11-08T17:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: sas 9.4 data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-9-4-data-step/m-p/602778#M174558</link>
      <description>&lt;P&gt;Since you appear to be doing a form of simple random sample I might suggest:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc surveyselect data=have out=want
   sampsize=&amp;amp;sampsize.   selectall
   seed=&amp;amp;seed. stats   outall
;
run;&lt;/PRE&gt;
&lt;P&gt;The STATS option will show the selection probability and the sampleweight that you might want for any analysis using this data.&lt;/P&gt;
&lt;P&gt;The SELECTALL says to take all of the observations if the actual size of the data set is smaller than the requested sample size.&lt;/P&gt;
&lt;P&gt;The OUTALL option will have the output data set contain all records with a variable selected which =1 when selected and 0 otherwise.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2019 17:10:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-9-4-data-step/m-p/602778#M174558</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-08T17:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: sas 9.4 data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-9-4-data-step/m-p/602809#M174569</link>
      <description>&lt;P&gt;Thanks. My seed value was too long for mathematical evaluation. I reduced it to 6 digits and that resolved the issue. Thank you so much. I appreciate all the prompt responses.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2019 18:57:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-9-4-data-step/m-p/602809#M174569</guid>
      <dc:creator>Pooja2</dc:creator>
      <dc:date>2019-11-08T18:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: sas 9.4 data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-9-4-data-step/m-p/602862#M174599</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/129748"&gt;@Pooja2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Seed value I am getting from lets statement and &amp;amp;I value I am getting from a data step;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it is a macro&lt;/P&gt;
&lt;P&gt;% lets samplesize = 40;&lt;/P&gt;
&lt;P&gt;%lets seed = 12345;&lt;/P&gt;
&lt;P&gt;%lets number = 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro want;&lt;/P&gt;
&lt;P&gt;do I = 1 %to &amp;amp;number;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have nobs=tot;&lt;/P&gt;
&lt;P&gt;retain;&lt;/P&gt;
&lt;P&gt;select = min(&amp;amp;samplesize, tot);&lt;/P&gt;
&lt;P&gt;do I = Tot to 1 by -1;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;if ranuni(&amp;amp;seed + (&amp;amp;I - 1)) &amp;lt; select /I then do;&lt;/P&gt;
&lt;P&gt;select + - 1;&lt;/P&gt;
&lt;P&gt;output;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%mend want;&lt;/P&gt;
&lt;P&gt;%want;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This code is so full of syntax errors that it won't do anything. Get a simple data step to run correctly before you try anything harder; in particular, refrain from macro coding at all until you have a solid grasp of non-macro SAS coding.&lt;/P&gt;
&lt;P&gt;I suggest you work through the free online Programming 1 course to learn the basics.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2019 20:25:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-9-4-data-step/m-p/602862#M174599</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-08T20:25:10Z</dc:date>
    </item>
  </channel>
</rss>

