<?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: Viewing the actual variable names in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Viewing-the-actual-variable-names-in-SAS/m-p/712789#M219815</link>
    <description>Proc contents data=Lib.dataset-name;&lt;BR /&gt;Run;</description>
    <pubDate>Wed, 20 Jan 2021 17:00:03 GMT</pubDate>
    <dc:creator>SurajSaini</dc:creator>
    <dc:date>2021-01-20T17:00:03Z</dc:date>
    <item>
      <title>Viewing the actual variable names in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Viewing-the-actual-variable-names-in-SAS/m-p/712787#M219814</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am importing a .csv file into SAS that has variable names like "Collection Date", "Patient Result". The variables appear the same in SAS after I import, except I can't call them because I know they actually don't have a space in their name after the import. How do I see what they actually are called? I've tried running :&lt;/P&gt;&lt;PRE&gt;options validvarname=v7&lt;/PRE&gt;&lt;P&gt;But that didn't seem to work. I tried the above with =v6, v9, and any and that didn't work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Clare&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 16:55:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Viewing-the-actual-variable-names-in-SAS/m-p/712787#M219814</guid>
      <dc:creator>claremc</dc:creator>
      <dc:date>2021-01-20T16:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: Viewing the actual variable names in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Viewing-the-actual-variable-names-in-SAS/m-p/712789#M219815</link>
      <description>Proc contents data=Lib.dataset-name;&lt;BR /&gt;Run;</description>
      <pubDate>Wed, 20 Jan 2021 17:00:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Viewing-the-actual-variable-names-in-SAS/m-p/712789#M219815</guid>
      <dc:creator>SurajSaini</dc:creator>
      <dc:date>2021-01-20T17:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: Viewing the actual variable names in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Viewing-the-actual-variable-names-in-SAS/m-p/712791#M219817</link>
      <description>&lt;P&gt;In most (all?) SAS interfaces, there is a Library/data set viewer, and as far as I know its always on the left and if you double-click on a data set in a library, you get to see (a portion of) the data and the column names that way. Scrolling will let you see all of the data and all of the column names.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 17:02:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Viewing-the-actual-variable-names-in-SAS/m-p/712791#M219817</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-01-20T17:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: Viewing the actual variable names in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Viewing-the-actual-variable-names-in-SAS/m-p/712793#M219819</link>
      <description>&lt;P&gt;VALIDVARNAME controls how variable names are created. V7 means it will use underscore not spaces.&lt;/P&gt;
&lt;P&gt;You can use PROC DATASETS/CONTENTS to see variable names but you can also strip the labels off if you'd like.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For a data set, CLASS, in a library called MYLIB the following will strip all labels.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets lib=mylib memtype=data;
   modify class;
     attrib _all_ label=' ';
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/359435"&gt;@claremc&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am importing a .csv file into SAS that has variable names like "Collection Date", "Patient Result". The variables appear the same in SAS after I import, except I can't call them because I know they actually don't have a space in their name after the import. How do I see what they actually are called? I've tried running :&lt;/P&gt;
&lt;PRE&gt;options validvarname=v7&lt;/PRE&gt;
&lt;P&gt;But that didn't seem to work. I tried the above with =v6, v9, and any and that didn't work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;Clare&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 17:06:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Viewing-the-actual-variable-names-in-SAS/m-p/712793#M219819</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-01-20T17:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Viewing the actual variable names in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Viewing-the-actual-variable-names-in-SAS/m-p/712796#M219821</link>
      <description>&lt;P&gt;The Validvarname=V7 means that characters not valid in SAS names will be replaced with _ characters as opposed to Validvarname=Any which would allow spaces and other characters. However you would then have to use name-literals in the code: 'Collection Date'n evertime to use the variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you run proc import data step code is generated and appears in the log with the names of the variables in INFORMAT, FORMAT and INPUT statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an idea: write a data step to change the names to what you like. You can copy that generated code and replace "Collection_Date" with "CollectionDate" if that is what you would prefer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A very useful side effect of modifying the code is that you can set standard lengths/ types for other files of the same structure. Just change the Infile statement to point to a new file and change the name of Data set&amp;nbsp; for output.&lt;/P&gt;
&lt;P&gt;Then you will avoid all the problems associated with mismatched variable types or lengths of character variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 17:25:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Viewing-the-actual-variable-names-in-SAS/m-p/712796#M219821</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-20T17:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: Viewing the actual variable names in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Viewing-the-actual-variable-names-in-SAS/m-p/712882#M219840</link>
      <description>&lt;P&gt;If these really are the variable names, you can refer to them in your subsequent programming using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Collection date"n&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The n after the closed quote indicates that this is a name, not a character string in quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The option you used:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;validvarname=v7;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;will work, but you need that option in place before you import the data, not after.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 20:32:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Viewing-the-actual-variable-names-in-SAS/m-p/712882#M219840</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-01-20T20:32:27Z</dc:date>
    </item>
  </channel>
</rss>

