<?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: table values as syntax in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/table-values-as-syntax/m-p/614579#M179701</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/49317"&gt;@antonsvart&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the PROC DATASETS (&lt;A href="https://documentation.sas.com/?docsetId=proc&amp;amp;docsetVersion=9.4&amp;amp;docsetTarget=n0mfav25learpan1lerk79jsp30n.htm&amp;amp;locale=en" target="_self"&gt;link&lt;/A&gt;) to do this kind of manipulation, including:&lt;/P&gt;
&lt;UL class="xisDoc-listUnordered"&gt;
&lt;LI class="xisDoc-item"&gt;modifying SAS files&lt;/LI&gt;
&lt;LI class="xisDoc-item"&gt;labeling a SAS data set&lt;/LI&gt;
&lt;LI class="xisDoc-item"&gt;adding a Read password to a SAS data set&lt;/LI&gt;
&lt;LI class="xisDoc-item"&gt;indicating how a SAS data set is currently sorted&lt;/LI&gt;
&lt;LI class="xisDoc-item"&gt;creating an index for a SAS data set&lt;/LI&gt;
&lt;LI class="xisDoc-item"&gt;assigning informats and formats to variables in a SAS data set -&amp;gt; &lt;EM&gt;your use case&lt;/EM&gt;.&lt;/LI&gt;
&lt;LI class="xisDoc-item"&gt;renaming variables in a SAS data set&lt;/LI&gt;
&lt;LI class="xisDoc-item"&gt;labeling variables in a SAS data set&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;e.g.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets lib=work;
	modify mydata;
	informat patient_id $32.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you have these statements stored in a dataset, you can use the DOSUBL() function or the CALL EXECUTE :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	InformatStatement = 'informat patient_id $32. ;'; output;
	InformatStatement = 'informat date date9. ;'; output;
run;

data _null_;
	set have;
	rc = dosubl(cats('proc datasets lib=work; modify mydata; ',informatStatement,'; run;'));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;NB: replace 'mydata' by your dataset name in the modify statement.&lt;/P&gt;
&lt;P&gt;-&amp;gt; this will execute the proc datasets at each iteration according to the value of the 'InformationStatement' variable in the 'have' dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 31 Dec 2019 17:15:28 GMT</pubDate>
    <dc:creator>ed_sas_member</dc:creator>
    <dc:date>2019-12-31T17:15:28Z</dc:date>
    <item>
      <title>table values as syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/table-values-as-syntax/m-p/614573#M179696</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to use some concatenated informat, format, and input statements that live within a SAS table to function as syntax in a data step. E.g. the following statement&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;informat patient_id $32. ;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;is a value of a column called "informatStatement".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How would I be able to use these stored values as statements in an actual data step for many other variable (not just patient_id) and many other tables? Or am I going about this all wrong? I'm using base SAS 9.4. Thanks for your help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Dec 2019 16:40:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/table-values-as-syntax/m-p/614573#M179696</guid>
      <dc:creator>antonsvart</dc:creator>
      <dc:date>2019-12-31T16:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: table values as syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/table-values-as-syntax/m-p/614579#M179701</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/49317"&gt;@antonsvart&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the PROC DATASETS (&lt;A href="https://documentation.sas.com/?docsetId=proc&amp;amp;docsetVersion=9.4&amp;amp;docsetTarget=n0mfav25learpan1lerk79jsp30n.htm&amp;amp;locale=en" target="_self"&gt;link&lt;/A&gt;) to do this kind of manipulation, including:&lt;/P&gt;
&lt;UL class="xisDoc-listUnordered"&gt;
&lt;LI class="xisDoc-item"&gt;modifying SAS files&lt;/LI&gt;
&lt;LI class="xisDoc-item"&gt;labeling a SAS data set&lt;/LI&gt;
&lt;LI class="xisDoc-item"&gt;adding a Read password to a SAS data set&lt;/LI&gt;
&lt;LI class="xisDoc-item"&gt;indicating how a SAS data set is currently sorted&lt;/LI&gt;
&lt;LI class="xisDoc-item"&gt;creating an index for a SAS data set&lt;/LI&gt;
&lt;LI class="xisDoc-item"&gt;assigning informats and formats to variables in a SAS data set -&amp;gt; &lt;EM&gt;your use case&lt;/EM&gt;.&lt;/LI&gt;
&lt;LI class="xisDoc-item"&gt;renaming variables in a SAS data set&lt;/LI&gt;
&lt;LI class="xisDoc-item"&gt;labeling variables in a SAS data set&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;e.g.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets lib=work;
	modify mydata;
	informat patient_id $32.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you have these statements stored in a dataset, you can use the DOSUBL() function or the CALL EXECUTE :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	InformatStatement = 'informat patient_id $32. ;'; output;
	InformatStatement = 'informat date date9. ;'; output;
run;

data _null_;
	set have;
	rc = dosubl(cats('proc datasets lib=work; modify mydata; ',informatStatement,'; run;'));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;NB: replace 'mydata' by your dataset name in the modify statement.&lt;/P&gt;
&lt;P&gt;-&amp;gt; this will execute the proc datasets at each iteration according to the value of the 'InformationStatement' variable in the 'have' dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Dec 2019 17:15:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/table-values-as-syntax/m-p/614579#M179701</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-12-31T17:15:28Z</dc:date>
    </item>
  </channel>
</rss>

