<?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: Understanding Call Symput! in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97612#M27552</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, there is a lot of information in this.&amp;nbsp; ID1 has the value for the first observation (assuming you don't re-order the data set).&amp;nbsp; ID127 has the value for the 127th observation.&amp;nbsp; "n" tells us how many macro variables were created.&amp;nbsp; If you want to access all the variables created then you'll need this number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, this will reveal the values of all the macro variables you just created.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Typically, I'll group things together so I can process things differently.&amp;nbsp; I wouldn't use the method you're asking about.&amp;nbsp; I assume this is just an example of how to create many different macro variables at once.&amp;nbsp; I can't really see how to use that.&amp;nbsp; I can always do the following: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the end you'll have as many different data sets as you have different sexes.&amp;nbsp; All the sets will combine to recreate the original data set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* the loop won't run in open code */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;DROP TABLE sex_count;&lt;/P&gt;&lt;P&gt;CREATE TABLE sex_count as&lt;/P&gt;&lt;P&gt;select distinct sex&lt;/P&gt;&lt;P&gt;from class&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;%let number_of_sexes = &amp;amp;sqlobs;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%do i = 1 %to &amp;amp;number_of_sexes;&lt;/P&gt;&lt;P&gt;&amp;nbsp; DATA _NULL_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x=&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SET sex_count point=x;&lt;/P&gt;&lt;P&gt;&amp;nbsp; CALL SYMPUT('CDE_SEX', sex);&lt;/P&gt;&lt;P&gt;&amp;nbsp; stop;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put &amp;amp;CDE_SEX;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PROC SQL;&lt;/P&gt;&lt;P&gt;&amp;nbsp; DROP TABLE _.&amp;amp;CDE_SEX;&lt;/P&gt;&lt;P&gt;&amp;nbsp; CREATE TABLE _.&amp;amp;CDE_SEX as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select *&lt;/P&gt;&lt;P&gt;&amp;nbsp; from class&lt;/P&gt;&lt;P&gt;&amp;nbsp; where SEX = "&amp;amp;CDE_SEX"&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another method to use is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL noprint;&lt;/P&gt;&lt;P&gt;SELECT sex&lt;/P&gt;&lt;P&gt;&amp;nbsp; into :id1 - :id&amp;amp;n&lt;/P&gt;&lt;P&gt;from class&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But you'll need to define "n" ahead of time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe I put too much in here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 04 Apr 2013 16:06:43 GMT</pubDate>
    <dc:creator>Wesley</dc:creator>
    <dc:date>2013-04-04T16:06:43Z</dc:date>
    <item>
      <title>Understanding Call Symput!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97600#M27540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the below data _null_ code:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1)&lt;/STRONG&gt;How can I get to see the logic???I used the following options and still I cant find the logic in the log&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options MPRINT MLOGIC SYMBOLGEN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2)&lt;/STRONG&gt;What is the meaning of:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;call symputx(cats(&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;'id'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;,_n_),sex);&amp;nbsp;&amp;nbsp; /*especially what is the _n_ doing here*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=sashelp.class(keep=sex) out=class nodupkey;&lt;BR /&gt;by sex;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set class end=last ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; call symputx(cats('id',_n_),sex);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if last then call symputx('n',_n_);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 13:40:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97600#M27540</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2013-04-04T13:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Call Symput!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97601#M27541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this:&lt;/P&gt;&lt;P&gt;data class;&lt;/P&gt;&lt;P&gt; set sashelp.class;&lt;/P&gt;&lt;P&gt;postion_of_observation=_n_;&lt;/P&gt;&lt;P&gt;proc print;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 13:58:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97601#M27541</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2013-04-04T13:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Call Symput!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97602#M27542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried and it (_n_)gives the observation number....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I still could not understand :&lt;/P&gt;&lt;P&gt;call symputx(cats('id',_n_),sex);&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Please correct me:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;it is creating macro variables id concatenated with observation number and ??????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 14:07:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97602#M27542</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2013-04-04T14:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Call Symput!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97603#M27543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes macro variables ID1 and ID2 with the values F and M respecfively.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 14:19:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97603#M27543</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-04-04T14:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Call Symput!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97604#M27544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, it creates macro variables &amp;amp;id1,&amp;amp;id2,....;&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input sex$ ;&lt;BR /&gt;cards;&lt;BR /&gt;f&lt;BR /&gt;m&lt;BR /&gt;f&lt;BR /&gt;;&lt;BR /&gt;data _null_;&lt;BR /&gt; set have;&lt;BR /&gt; call symputx(cats('id',_n_),sex);&lt;BR /&gt;run;&lt;BR /&gt;%put &amp;amp;id1;&lt;BR /&gt;%put &amp;amp;id2;&lt;BR /&gt;%put &amp;amp;id3;&lt;/P&gt;&lt;P&gt;/* log file */&lt;/P&gt;&lt;P&gt;440&amp;nbsp; data have;&lt;BR /&gt;441&amp;nbsp; input sex$ ;&lt;BR /&gt;442&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.HAVE has 3 observations and 1 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;446&amp;nbsp; ;&lt;BR /&gt;447&amp;nbsp; data _null_;&lt;BR /&gt;448&amp;nbsp;&amp;nbsp; set have;&lt;BR /&gt;449&amp;nbsp;&amp;nbsp; call symputx(cats('id',_n_),sex);&lt;BR /&gt;450&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;NOTE: There were 3 observations read from the data set WORK.HAVE.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.01 seconds&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.01 seconds&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;451&amp;nbsp; %put &amp;amp;id1;&lt;BR /&gt;f&lt;BR /&gt;452&amp;nbsp; %put &amp;amp;id2;&lt;BR /&gt;m&lt;BR /&gt;453&amp;nbsp; %put &amp;amp;id3;&lt;BR /&gt;f&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 14:20:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97604#M27544</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2013-04-04T14:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Call Symput!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97605#M27545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much.&lt;/P&gt;&lt;P&gt;So far I was thinking only one macro variable can be created using call symput&lt;/P&gt;&lt;P&gt;But now I learnt that we can create as many variables as possible(for example if there are 10 observations under a particular variable we can create 10 macro variables......each macro variable getting the 10 value available under that variable????????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PLEASE CORRECT!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 14:30:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97605#M27545</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2013-04-04T14:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Call Symput!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97606#M27546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Robert,&lt;/P&gt;&lt;P&gt;Yes it is creating a macro variable Concatenating ID &amp;amp; the observation number and for the specific macro variable, it is assinging the value of SEX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, See the result by using %put _user_ ;&lt;/P&gt;&lt;P&gt;GLOBAL ID10 M&lt;/P&gt;&lt;P&gt;GLOBAL ID1 M&lt;/P&gt;&lt;P&gt;GLOBAL ID11 F&lt;/P&gt;&lt;P&gt;GLOBAL ID2 F&lt;/P&gt;&lt;P&gt;GLOBAL ID12 F&lt;/P&gt;&lt;P&gt;GLOBAL ID3 F&lt;/P&gt;&lt;P&gt;GLOBAL ID13 F&lt;/P&gt;&lt;P&gt;GLOBAL ID4 F&lt;/P&gt;&lt;P&gt;GLOBAL ID14 F&lt;/P&gt;&lt;P&gt;GLOBAL ID5 M&lt;/P&gt;&lt;P&gt;GLOBAL ID15 M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 14:32:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97606#M27546</guid>
      <dc:creator>SOORISAS</dc:creator>
      <dc:date>2013-04-04T14:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Call Symput!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97607#M27547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes you can create as many macro variables as possible.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 14:34:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97607#M27547</guid>
      <dc:creator>SOORISAS</dc:creator>
      <dc:date>2013-04-04T14:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Call Symput!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97608#M27548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can create only one variable per statement.&amp;nbsp; That statement is being called for each record in the HAVE dataset.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 14:50:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97608#M27548</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2013-04-04T14:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Call Symput!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97609#M27549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't forget the last macro variable that's being created.&amp;nbsp; That would be "n".&amp;nbsp; The number of observations is being stored there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 15:22:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97609#M27549</guid>
      <dc:creator>Wesley</dc:creator>
      <dc:date>2013-04-04T15:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Call Symput!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97610#M27550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Knowing how many macro variables are created will allow you to use a loop such as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*inside a macro of course*/&lt;/P&gt;&lt;P&gt;%do i = 1 %to &amp;amp;n;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put id&amp;amp;i = &amp;amp;&amp;amp;id&amp;amp;i;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you'll be able to see all the values that got assigned to the list of macro variables you created.&amp;nbsp; There are many other nice things you can do too.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 15:30:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97610#M27550</guid>
      <dc:creator>Wesley</dc:creator>
      <dc:date>2013-04-04T15:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Call Symput!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97611#M27551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot for the detailed information.&lt;/P&gt;&lt;P&gt;Also in the below what is the use of knowing the the number of observations???&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set class end=last ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; call symputx(cats('id',_n_),sex);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if last then call symputx('n',_n_);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also the macro and a do looop you explained gives us the list of macro variables created and their assigned values right???????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 15:40:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97611#M27551</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2013-04-04T15:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Call Symput!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97612#M27552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, there is a lot of information in this.&amp;nbsp; ID1 has the value for the first observation (assuming you don't re-order the data set).&amp;nbsp; ID127 has the value for the 127th observation.&amp;nbsp; "n" tells us how many macro variables were created.&amp;nbsp; If you want to access all the variables created then you'll need this number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, this will reveal the values of all the macro variables you just created.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Typically, I'll group things together so I can process things differently.&amp;nbsp; I wouldn't use the method you're asking about.&amp;nbsp; I assume this is just an example of how to create many different macro variables at once.&amp;nbsp; I can't really see how to use that.&amp;nbsp; I can always do the following: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the end you'll have as many different data sets as you have different sexes.&amp;nbsp; All the sets will combine to recreate the original data set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* the loop won't run in open code */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;DROP TABLE sex_count;&lt;/P&gt;&lt;P&gt;CREATE TABLE sex_count as&lt;/P&gt;&lt;P&gt;select distinct sex&lt;/P&gt;&lt;P&gt;from class&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;%let number_of_sexes = &amp;amp;sqlobs;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%do i = 1 %to &amp;amp;number_of_sexes;&lt;/P&gt;&lt;P&gt;&amp;nbsp; DATA _NULL_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x=&amp;amp;i;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SET sex_count point=x;&lt;/P&gt;&lt;P&gt;&amp;nbsp; CALL SYMPUT('CDE_SEX', sex);&lt;/P&gt;&lt;P&gt;&amp;nbsp; stop;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put &amp;amp;CDE_SEX;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PROC SQL;&lt;/P&gt;&lt;P&gt;&amp;nbsp; DROP TABLE _.&amp;amp;CDE_SEX;&lt;/P&gt;&lt;P&gt;&amp;nbsp; CREATE TABLE _.&amp;amp;CDE_SEX as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select *&lt;/P&gt;&lt;P&gt;&amp;nbsp; from class&lt;/P&gt;&lt;P&gt;&amp;nbsp; where SEX = "&amp;amp;CDE_SEX"&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another method to use is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL noprint;&lt;/P&gt;&lt;P&gt;SELECT sex&lt;/P&gt;&lt;P&gt;&amp;nbsp; into :id1 - :id&amp;amp;n&lt;/P&gt;&lt;P&gt;from class&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But you'll need to define "n" ahead of time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe I put too much in here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 16:06:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97612#M27552</guid>
      <dc:creator>Wesley</dc:creator>
      <dc:date>2013-04-04T16:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Call Symput!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97613#M27553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much for your time...Its good to Know&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 16:14:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97613#M27553</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2013-04-04T16:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Call Symput!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97614#M27554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay, I just re-read your original question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following will give you a data set in work that has only as many records as there are distinct values of sex.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=sashelp.class(keep=sex) out=class nodupkey;&lt;BR /&gt;by sex;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following will create a macro variable for each unique value of sex.&amp;nbsp; If the only values are Male and Female then:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ID1 = Female&lt;/P&gt;&lt;P&gt;ID2 = Male&lt;/P&gt;&lt;P&gt;n = 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since this was sorted by sex (default is ascending) and F comes before M.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set class end=last ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; call symputx(cats('id',_n_),sex);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if last then call symputx('n',_n_);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 16:14:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97614#M27554</guid>
      <dc:creator>Wesley</dc:creator>
      <dc:date>2013-04-04T16:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Call Symput!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97615#M27555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much Wesley for your time abd help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 16:20:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97615#M27555</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2013-04-04T16:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Call Symput!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97616#M27556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I hear you talking about _N_ as the observation number.&amp;nbsp; However, _N_ is actually the number of times the code cycled to the DATA statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this code to see what I mean:&lt;/P&gt;&lt;P&gt;data new_class;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set sashelp.class;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if sex eq 'M' then return;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; x=_n_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=new_class; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the original class had 19 obs, new_class has only 9.&lt;/P&gt;&lt;P&gt;look at the values for x they are not the same as the obs number, but the number of times the code hit the DATA statement.&lt;/P&gt;&lt;P&gt;Just be crateful when referring to _N_ as the observation number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;MRG&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 17:13:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97616#M27556</guid>
      <dc:creator>mrgibson</dc:creator>
      <dc:date>2013-04-04T17:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Call Symput!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97617#M27557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great Help....I understand whay you mean...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 17:19:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97617#M27557</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2013-04-04T17:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Call Symput!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97618#M27558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This thread is about creating lists of macro variables&lt;/P&gt;&lt;P&gt;and this paper covers the various ways of handling such lists.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://www.sascommunity.org/wiki/List_Processing_Basics_Creating_and_Using_Lists_of_Macro_Variables" title="http://www.sascommunity.org/wiki/List_Processing_Basics_Creating_and_Using_Lists_of_Macro_Variables"&gt;http://www.sascommunity.org/wiki/List_Processing_Basics_Creating_and_Using_Lists_of_Macro_Variables&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ron Fehd&amp;nbsp; List Processing maven&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 21:36:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-Call-Symput/m-p/97618#M27558</guid>
      <dc:creator>Ron_MacroMaven</dc:creator>
      <dc:date>2013-04-04T21:36:28Z</dc:date>
    </item>
  </channel>
</rss>

