<?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 variable for tracking data step processing in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-variable-for-tracking-data-step-processing/m-p/164678#M31833</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;Perhaps the &lt;SPAN style="font-family: 'courier new', courier;"&gt;%global&lt;/SPAN&gt; and &lt;SPAN style="font-family: 'courier new', courier;"&gt;%let&lt;/SPAN&gt; macro statements would be of help:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000206954.htm" title="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000206954.htm"&gt;SAS(R) 9.2 Macro Language: Reference&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000543704.htm" title="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000543704.htm"&gt;SAS(R) 9.2 Macro Language: Reference&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%global varvalue;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let varvalue=123;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; where var=&amp;amp;varvalue;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amir.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Dec 2013 13:04:18 GMT</pubDate>
    <dc:creator>Amir</dc:creator>
    <dc:date>2013-12-05T13:04:18Z</dc:date>
    <item>
      <title>SAS variable for tracking data step processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-variable-for-tracking-data-step-processing/m-p/164677#M31832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I would to determine if there is a record in a data set that contains a specific value for one of the variables in the data set. In other programming languages you can set a global variable (meaning it is available outside of the given function) to equal something when processing records indicates one of the records contains what you are looking for. You can use this variable in other programming steps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In SAS, is there a way to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Dec 2013 12:45:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-variable-for-tracking-data-step-processing/m-p/164677#M31832</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2013-12-05T12:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: SAS variable for tracking data step processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-variable-for-tracking-data-step-processing/m-p/164678#M31833</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;Perhaps the &lt;SPAN style="font-family: 'courier new', courier;"&gt;%global&lt;/SPAN&gt; and &lt;SPAN style="font-family: 'courier new', courier;"&gt;%let&lt;/SPAN&gt; macro statements would be of help:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000206954.htm" title="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000206954.htm"&gt;SAS(R) 9.2 Macro Language: Reference&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000543704.htm" title="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000543704.htm"&gt;SAS(R) 9.2 Macro Language: Reference&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%global varvalue;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let varvalue=123;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; where var=&amp;amp;varvalue;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amir.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Dec 2013 13:04:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-variable-for-tracking-data-step-processing/m-p/164678#M31833</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2013-12-05T13:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: SAS variable for tracking data step processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-variable-for-tracking-data-step-processing/m-p/164679#M31834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sounds to me like you want to set macro variables but as with a lot of things in SAS there are multiple approaches and Im not sure given the broad nature of the question what would be best in your situation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In general you can use %let to set a macro variable that basically stores the text you want to use else where in the code:&lt;/P&gt;&lt;P&gt;%let &lt;EM&gt;&lt;STRONG&gt;macrovarname &lt;/STRONG&gt;&lt;/EM&gt;= &lt;EM&gt;&lt;STRONG&gt;stored value or code &lt;/STRONG&gt;&lt;/EM&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then use the macro variable using &amp;amp;&lt;EM&gt;&lt;STRONG&gt;macrovarname&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simple example,&lt;/P&gt;&lt;P&gt;%let where = id in (3, 4 , 5, 20 , 33) ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table limitedresults as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select *&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from olddata&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where &amp;amp;where&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;More specifics about what you are trying to do may help craft a better solution by the community.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;EJ&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Dec 2013 13:12:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-variable-for-tracking-data-step-processing/m-p/164679#M31834</guid>
      <dc:creator>esjackso</dc:creator>
      <dc:date>2013-12-05T13:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: SAS variable for tracking data step processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-variable-for-tracking-data-step-processing/m-p/164680#M31835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi EJ&lt;/P&gt;&lt;P&gt;Your example with a 'macro' variable does not use a macro though. Do you need to use a macro variable only in a marco?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Dec 2013 13:18:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-variable-for-tracking-data-step-processing/m-p/164680#M31835</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2013-12-05T13:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: SAS variable for tracking data step processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-variable-for-tracking-data-step-processing/m-p/164681#M31836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe %let when used in open code defaults to a global macro variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Dec 2013 13:21:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-variable-for-tracking-data-step-processing/m-p/164681#M31836</guid>
      <dc:creator>esjackso</dc:creator>
      <dc:date>2013-12-05T13:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS variable for tracking data step processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-variable-for-tracking-data-step-processing/m-p/164682#M31837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Macro variables are available to use outside of a formal macro definition. Try the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let make = Acura;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data temp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set sashelp.cars;&lt;/P&gt;&lt;P&gt;&amp;nbsp; where make = "&amp;amp;make";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should get the dataset TEMP with 7 observations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Dec 2013 13:25:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-variable-for-tracking-data-step-processing/m-p/164682#M31837</guid>
      <dc:creator>esjackso</dc:creator>
      <dc:date>2013-12-05T13:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: SAS variable for tracking data step processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-variable-for-tracking-data-step-processing/m-p/164683#M31838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As others have indicated, creating a macro variable is the right way to go.&amp;nbsp; You don't need to define a macro in order to create and use a macro variable.&amp;nbsp; However ... if you plan to use that macro variable to determine which steps should run later in the program, you will probably need to define a macro.&amp;nbsp; The reason is that macro language %IF / %THEN statements can appear only inside a macro definition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Dec 2013 13:53:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-variable-for-tracking-data-step-processing/m-p/164683#M31838</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-12-05T13:53:48Z</dc:date>
    </item>
  </channel>
</rss>

