<?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: Validate column names and fetch data into macro variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Validate-column-names-and-fetch-data-into-macro-variables/m-p/366093#M87040</link>
    <description>&lt;P&gt;You cannot export data from Excel to a SAS dataset; Excel cannot write SAS datasets.&lt;/P&gt;
&lt;P&gt;So please describe exactly what you have done to get the data into SAS (which file format was written from Excel, and which step was used in SAS for import)&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jun 2017 09:54:24 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-06-12T09:54:24Z</dc:date>
    <item>
      <title>Validate column names and fetch data into macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Validate-column-names-and-fetch-data-into-macro-variables/m-p/366092#M87039</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have imported data from excel to a sas-data set. The dataset after exporting looks like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Name| ID | Salary | Designation&lt;/P&gt;
&lt;P&gt;------------------------------------------------&lt;/P&gt;
&lt;P&gt;ABC &amp;nbsp;| 11 | 2000$ | Manager&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The table will only have 1 column .&lt;/P&gt;
&lt;P&gt;Now I want to validate the column label if an if condition and store the value of column in a macro variable:-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;pseudo code:-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if macro_label="Name"
then do;
call symput(symget('myMVar'),Name);
end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please suggest a way to validate the column labels of a sas dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 12:12:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Validate-column-names-and-fetch-data-into-macro-variables/m-p/366092#M87039</guid>
      <dc:creator>Aditi24</dc:creator>
      <dc:date>2017-06-12T12:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Validate column names and fetch data into macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Validate-column-names-and-fetch-data-into-macro-variables/m-p/366093#M87040</link>
      <description>&lt;P&gt;You cannot export data from Excel to a SAS dataset; Excel cannot write SAS datasets.&lt;/P&gt;
&lt;P&gt;So please describe exactly what you have done to get the data into SAS (which file format was written from Excel, and which step was used in SAS for import)&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 09:54:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Validate-column-names-and-fetch-data-into-macro-variables/m-p/366093#M87040</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-12T09:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: Validate column names and fetch data into macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Validate-column-names-and-fetch-data-into-macro-variables/m-p/366096#M87043</link>
      <description>&lt;P&gt;If you have have imported the Excel file into SAS then the metadata will be present in the metadata tables. &amp;nbsp;For instance, if I have a dataset ABC in WORK, then:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set sashelp.vcolumns (where=(libname="WORK" and memname="ABC" and name="COL1"));
  call symputx('myVar',name);
run;&lt;/PRE&gt;
&lt;P&gt;Would work. &amp;nbsp;However, why put a column label in a macro variable. &amp;nbsp;It is already present in the metadata tables, so when you want to use it, pull the information from there. &amp;nbsp;Otherwise you may hit several road blocks (invalida characters, line lengths for multiples, multiple values etc.). &amp;nbsp;If you can elaborate on what you are doing we can look.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 10:27:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Validate-column-names-and-fetch-data-into-macro-variables/m-p/366096#M87043</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-12T10:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: Validate column names and fetch data into macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Validate-column-names-and-fetch-data-into-macro-variables/m-p/366118#M87054</link>
      <description>&lt;P&gt;Hello, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/55268"&gt;@Aditi24&lt;/a&gt;, I'm really having trouble understanding your problem. Could you give specific examples of what macro variables you want to create from this input data, and what values they should have?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;, you ask "However, why put a column label in a macro variable." Because that's one legitimate use of macro variables, to contain and make use of text that might vary from one execution of the program to another.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 12:30:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Validate-column-names-and-fetch-data-into-macro-variables/m-p/366118#M87054</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-06-12T12:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Validate column names and fetch data into macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Validate-column-names-and-fetch-data-into-macro-variables/m-p/366119#M87055</link>
      <description>&lt;P&gt;Please do stop spamming my posts where I ask simple questions. &amp;nbsp;The reason I asked the question is clearly stated in the text:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;"However, why put a column label in a macro variable. &amp;nbsp;It is already present in the metadata tables, so when you want to use it, pull the information from there."&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Of which you have only quoted part. &amp;nbsp;In most scenarios it would be quicker and simpler to refer to an existing dataset which contains the required information than to create a whole set of coding to emulate that which is already freely available. &amp;nbsp;If there are specific set of circumstances where this is needed, then other points have to be raised about sepcial characters when de-referencing etc.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 12:39:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Validate-column-names-and-fetch-data-into-macro-variables/m-p/366119#M87055</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-12T12:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: Validate column names and fetch data into macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Validate-column-names-and-fetch-data-into-macro-variables/m-p/366125#M87057</link>
      <description>&lt;P&gt;Ok, RW9, I'll quote the whole thing next time. I still state that putting text into a macro variable for use in a program is a perfectly&amp;nbsp;legitimate thing to do.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 12:57:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Validate-column-names-and-fetch-data-into-macro-variables/m-p/366125#M87057</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-06-12T12:57:38Z</dc:date>
    </item>
  </channel>
</rss>

