<?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: Linlin's Code Interpretation Please in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125744#M34580</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes. &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.800000190734863px; background-color: #ffffff;"&gt;&lt;SPAN style="color: #ff0000;"&gt;libname test "C:\Data\Projects\HELP\tete.xls";&lt;/SPAN&gt;&amp;nbsp; created an excel file.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 22 Sep 2012 22:24:55 GMT</pubDate>
    <dc:creator>Linlin</dc:creator>
    <dc:date>2012-09-22T22:24:55Z</dc:date>
    <item>
      <title>Linlin's Code Interpretation Please</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125730#M34566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;BELOW iS LINLINS CODE FOR CONVERTING OBSERVATIONS DIRECTLY TO EXCEL TABS(WITHOUT THE INTERMEDIATE DATASET CREATION)&lt;/P&gt;&lt;P&gt;Dataset to be plugged in:MYDATASET&lt;/P&gt;&lt;P&gt;variable to keep:billnumber&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you explain me the steps from 1-5&amp;nbsp; labelled in the bottom code.&lt;/P&gt;&lt;P&gt;What will go in place of 'id' in 1;&lt;/P&gt;&lt;P&gt;I guess sex in 1 is replaced by billnumber (then what about id???)&lt;/P&gt;&lt;P&gt;what will go in the place of n (in 2)&lt;/P&gt;&lt;P&gt;what is dsn in 5??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a ton&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;BR /&gt;run;&lt;BR /&gt;/* create macro variables */&lt;BR /&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;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* delete the file in case you run the code more than once */&lt;/P&gt;&lt;P&gt;FILENAME MyFile " my location"&amp;nbsp; ;&lt;BR /&gt;&amp;nbsp; DATA _NULL_ ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc = FDELETE('MyFile') ;&lt;BR /&gt;&amp;nbsp; RUN ;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;FILENAME MyFile CLEAR ;&lt;/P&gt;&lt;P&gt;libname test " my location";&lt;BR /&gt;%macro test;&lt;BR /&gt; %do i=1 %to &amp;amp;n;&lt;BR /&gt; %let dsn=&amp;amp;&amp;amp;id&amp;amp;i;&lt;BR /&gt; data test.&amp;amp;dsn;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set sashelp.class(where=(sex="&amp;amp;dsn"));&lt;BR /&gt; run;&lt;BR /&gt; %end;&lt;BR /&gt; %mend test;&lt;BR /&gt; %test&lt;BR /&gt;libname test clear;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=&lt;SPAN style="color: #ff00ff;"&gt;MYDATASET&lt;/SPAN&gt;(keep=&lt;SPAN style="color: #ff00ff;"&gt;billnumber&lt;/SPAN&gt;) out=&lt;SPAN style="color: #99cc00;"&gt;class&lt;/SPAN&gt; nodupkey;&lt;BR /&gt;by &lt;SPAN style="color: #ff00ff;"&gt;billnumber&lt;/SPAN&gt; ;&lt;BR /&gt;run;&lt;BR /&gt;/* create macro variables */&lt;BR /&gt;data _null_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set &lt;SPAN style="color: #99cc00;"&gt;class&lt;/SPAN&gt; end=last ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; call symputx(cats('id',_n_),sex);&amp;nbsp;&amp;nbsp;&amp;nbsp; ------------------------------1&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if last then call symputx('n',_n_);&amp;nbsp; --------------------------------2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* delete the file in case you run the code more than once */&lt;/P&gt;&lt;P&gt;FILENAME MyFile " my location"&amp;nbsp; ; &lt;BR /&gt;&amp;nbsp; DATA _NULL_ ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc = FDELETE('MyFile') ;&lt;BR /&gt;&amp;nbsp; RUN ;&lt;BR /&gt;FILENAME MyFile CLEAR ;&lt;/P&gt;&lt;P&gt;libname test " my location";&lt;BR /&gt;%macro test;&lt;BR /&gt; %do i=1 %to &amp;amp;n;--------------------------------------------------------3&lt;BR /&gt; %let dsn=&amp;amp;&amp;amp;id&amp;amp;i; -----------------------------------------------------4&lt;BR /&gt; data test.&amp;amp;dsn;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set &lt;SPAN style="color: #ff00ff;"&gt;MYDATASET&lt;/SPAN&gt;(where=(&lt;SPAN style="color: #ff00ff;"&gt;billnumber&lt;/SPAN&gt;="&amp;amp;dsn"));-------------5&lt;BR /&gt; run;&lt;BR /&gt; %end;&lt;BR /&gt; %mend test;&lt;BR /&gt; %test&lt;BR /&gt;libname test clear;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2012 16:17:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125730#M34566</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-09-19T16:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: Linlin's Code Interpretation Please</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125731#M34567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't know if I'll have time to answer all of your questions but here is a start.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 1:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;proc sort data=sashelp.class(keep=sex) out=class nodupkey;&lt;BR /&gt;by sex;&lt;BR /&gt;run;&lt;BR /&gt;/* create macro variables */&lt;BR /&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;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;The use of proc sort with the nodupkey option and only keeping "sex", will create a file called "class" that only contains two records, one with "F" and one with "M" as the values for sex.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;The first call symputx statement will create two macro variables, &amp;amp;id1 and &amp;amp;id2, with values of "F" and "M", respectively.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;The second call symputx statement will create a macro variable, called "&amp;amp;m", that will have a value of "2"&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Actually, it might be easiest for you to see what is going on if you set three system options before you run the code and see if you can answer your own questions by reading the resulting log.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run the following statement before running your code:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;options mprint mlogic symbolgen;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2012 17:07:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125731#M34567</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-09-19T17:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: Linlin's Code Interpretation Please</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125732#M34568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try changing ...&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px; background-color: #ffffff;"&gt;data test.&amp;amp;dsn;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;to &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px; background-color: #ffffff;"&gt;data test._&amp;amp;dsn;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2012 17:33:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125732#M34568</guid>
      <dc:creator>shivas</dc:creator>
      <dc:date>2012-09-19T17:33:04Z</dc:date>
    </item>
    <item>
      <title>Re: Linlin's Code Interpretation Please</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125733#M34569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shiva,&lt;/P&gt;&lt;P&gt;Your suggestion really worked well.&lt;/P&gt;&lt;P&gt;Could you also please explain me what is happening in this macro code below after Arthur had given the explanation to the intitial steps of the code;&lt;/P&gt;&lt;P&gt;How di dyou predict the correct answer would be after I put the _(underscore);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname test "myfile";&lt;/P&gt;&lt;P&gt;%macro test;&lt;/P&gt;&lt;P&gt; %do i=1 %to &amp;amp;n;&lt;/P&gt;&lt;P&gt; %let dsn=&amp;amp;&amp;amp;id&amp;amp;i;&lt;/P&gt;&lt;P&gt; data test._&amp;amp;dsn;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set procedures_descrip2(where=(bill_no="&amp;amp;dsn"));&lt;/P&gt;&lt;P&gt; run;&lt;/P&gt;&lt;P&gt; %end;&lt;/P&gt;&lt;P&gt; %mend test;&lt;/P&gt;&lt;P&gt; %test&lt;/P&gt;&lt;P&gt;libname test clear;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2012 17:47:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125733#M34569</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-09-19T17:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Linlin's Code Interpretation Please</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125734#M34570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That one I can answer: a filename, in SAS, must begin with either a letter or an underscore.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2012 17:59:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125734#M34570</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-09-19T17:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Linlin's Code Interpretation Please</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125735#M34571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Again, since I didn't read all of the thread and don't know what the data really look like, I can only respond based on Shivas' comments.&amp;nbsp; The code reads:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;libname test " my location";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%macro test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%do i=1 %to &amp;amp;n;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%let dsn=&amp;amp;&amp;amp;id&amp;amp;i;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data test._&amp;amp;dsn;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; set sashelp.class(where=(sex="&amp;amp;dsn"));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%mend test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%test&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;It is just creating a loop that, in your case, is running the code between the %do and %end statements 26 times.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The %let statement is creating a macro variable which, from Shivas' comment and solution, is apparently equal to a number with leading zeros (e.g., &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;0000001&lt;/SPAN&gt;).&amp;nbsp; Then, the data step is run during each iteration creating files _000001, _000002, etc., simply setting your data file and using a where clause to only get those records that have the value that matches the specific number.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2012 18:33:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125735#M34571</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-09-19T18:33:04Z</dc:date>
    </item>
    <item>
      <title>Re: Linlin's Code Interpretation Please</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125736#M34572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You didn't consider the effect of the initial proc sort.&amp;nbsp; Linlin had suggested:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;proc sort data=sashelp.class(keep=sex) out=class nodupkey;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; by sex;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;That created a new file, called "class", that only contained two records, one for each sex.&amp;nbsp; Thus, when class was read in, in the next step, there were only two records, thus _n_ was equal to 1 for F and 2 for M.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;If you do the same thing with your data, you will initially create a file that only contains 26 records.&amp;nbsp; Thus, when it is read in, in a similar second step, _n_ will be equal to 1 thru 26 during the iterations.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2012 18:56:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125736#M34572</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-09-19T18:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: Linlin's Code Interpretation Please</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125737#M34573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I understand what you say...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;dsn=&amp;amp;&amp;amp;id&amp;amp;i;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;i have id1 thru id26 with the result of the step:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&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_),bill_no);&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;id1 has a value=000001&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;id2 has a value=000002&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;id3 has a value=000003 etc etc till id26 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;I WAS EXPECTING IT TO BE &lt;STRONG&gt;&amp;amp;idi INSTEAD OF &amp;amp;&amp;amp;id&amp;amp;i bcause :&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG&gt;when i=1 &amp;amp;idi I THOUGHT will get referenced to&amp;nbsp; 000001(since id1 above has 000001)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG&gt;when i=2 &amp;amp;idi I THOUGHT will get referenced to&amp;nbsp; 000002 (since id2 above has 000002)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG&gt;Could you explain me why we write the &amp;amp;i instead of only i???????&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG&gt;Thanks&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2012 19:33:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125737#M34573</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-09-19T19:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Linlin's Code Interpretation Please</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125738#M34574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you use a %do loop the iteration variable, i in this case, by definition becomes a macro variable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2012 19:59:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125738#M34574</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-09-19T19:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: Linlin's Code Interpretation Please</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125739#M34575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you post a copy of the code you are actually running I (or someone else) can try to answer your question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2012 14:18:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125739#M34575</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-09-20T14:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: Linlin's Code Interpretation Please</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125740#M34576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is the part of the code we discussed yesterday&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* delete the file in case you run the code more than once */&lt;/P&gt;&lt;P&gt;FILENAME MyFile " my location"&amp;nbsp; ;&lt;BR /&gt;&amp;nbsp; DATA _NULL_ ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc = FDELETE('MyFile') ;&lt;BR /&gt;&amp;nbsp; RUN ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2012 14:32:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125740#M34576</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-09-20T14:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: Linlin's Code Interpretation Please</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125741#M34577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;does the statement you submit really show:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;FILENAME MyFile " my location"&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;or have you changed " my location" to something else?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2012 14:37:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125741#M34577</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-09-20T14:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Linlin's Code Interpretation Please</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125742#M34578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shiva Arthur and Team,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all Linlins code works fine for sashelp.class dataset(without the underscore).&lt;/P&gt;&lt;P&gt;but when it comes to my dataset I was not getting the result until I put the underscore(shiva suggested) in the below step&amp;nbsp; (in italics):&lt;/P&gt;&lt;P&gt;Arthur corroborated saying that file names have to start with an underscore.&lt;/P&gt;&lt;P&gt;Also if the values for dsn are M and F :&lt;/P&gt;&lt;P&gt;data test.&amp;amp;dsn(talking about sas help.class dataset) is not creating anydatasets in the work library(i was thinking it would)....its directly creating&lt;/P&gt;&lt;P&gt;an Ecel file with the tabs M and F in the specified location.&lt;/P&gt;&lt;P&gt;1)WHY IS THE DATASETS NOT CREATED??????&lt;/P&gt;&lt;P&gt;2)WHY WAS I GETTING RESLUTS ONLY WHEN I INCLUDED AN UNDERSCORE WHEN IT WORKS FINE FOR SASHELP.CLASS WITHOUT PUTTING THE UNDERSCORE???????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ANY EFFORTS TO THESE TWO QUESTIONS ARE HIGHLY APPRECIATED...&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;libname test "C:\Data\Projects\HELP\tete.xls"; &lt;BR /&gt;%macro test;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;%do i=1 %to &amp;amp;n;&lt;BR /&gt; %let dsn=&amp;amp;&amp;amp;id&amp;amp;i;&lt;BR /&gt; &lt;/P&gt;&lt;P&gt; data test.&amp;amp;dsn;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="text-decoration: underline;"&gt;&lt;EM&gt; /* This is the step I am referring too */&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/SPAN&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i had to do datatest._&amp;amp;dsn&lt;/EM&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set sashelp.class(where=(sex="&amp;amp;dsn")); &lt;BR /&gt; run; &lt;BR /&gt;%end; &lt;BR /&gt; %mend test;&lt;BR /&gt; %test&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;libname test clear;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Sep 2012 21:17:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125742#M34578</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-09-22T21:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: Linlin's Code Interpretation Please</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125743#M34579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No datasets were created because you wanted excel file.&lt;/P&gt;&lt;P&gt;the modified code will create datasets for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you have to add "_" because you have IDs starting with numbers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname test "C:\Data\Projects\HELP\tete.xls"; &lt;/P&gt;&lt;P&gt;%macro test;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;%do i=1 %to &amp;amp;n;&lt;/P&gt;&lt;P&gt;%let dsn=&amp;amp;&amp;amp;id&amp;amp;i;&lt;/P&gt;&lt;P&gt;/* create sas dataset */&lt;/P&gt;&lt;P&gt;data _&amp;amp;dsn;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set sashelp.class(where=(sex="&amp;amp;dsn"));&lt;/P&gt;&lt;P&gt;/*&amp;nbsp; create excel file */&lt;/P&gt;&lt;P&gt;data test._&amp;amp;dsn;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* This is the step I am referring too */&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i had to do datatest._&amp;amp;dsn&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set _&amp;amp;dsn;&lt;/P&gt;&lt;P&gt;run; &lt;/P&gt;&lt;P&gt;%end; &lt;/P&gt;&lt;P&gt;%mend test;&lt;/P&gt;&lt;P&gt;%test&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;libname test clear;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Sep 2012 21:37:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125743#M34579</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-09-22T21:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Linlin's Code Interpretation Please</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125744#M34580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes. &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.800000190734863px; background-color: #ffffff;"&gt;&lt;SPAN style="color: #ff0000;"&gt;libname test "C:\Data\Projects\HELP\tete.xls";&lt;/SPAN&gt;&amp;nbsp; created an excel file.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Sep 2012 22:24:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Linlin-s-Code-Interpretation-Please/m-p/125744#M34580</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-09-22T22:24:55Z</dc:date>
    </item>
  </channel>
</rss>

