<?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 How to use &amp;quot;labels&amp;quot; (Excel column headers) instead of SAS &amp;quot;names&amp;quot; when plotting? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-quot-labels-quot-Excel-column-headers-instead-of-SAS/m-p/82627#M256737</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I imported into SAS an Excel spreadsheet successfully.&amp;nbsp; SAS, however, decided to create a "name" for each column of data, in addition to maintaining "label" for each column.&amp;nbsp; The "labels" correctly correspond to column headings in the original Excel file.&amp;nbsp; The SAS "names," however, are different from these "labels" -- apparently converted to SAS-speak.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When it comes time to plot a graph, SAS wants me to use the "names" it created, as opposed to the "labels."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This gets really confusing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to use "labels" in a plot statement, as opposed to "names"?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Solution greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nicholas Kormanik&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-email-small" href="mailto:nkormanik@gmail.com"&gt;nkormanik@gmail.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Code example using variable "names":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc gcontour data=smoothed;&lt;/P&gt;&lt;P&gt;plot _0801*_1301=_05010&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Jun 2012 06:00:10 GMT</pubDate>
    <dc:creator>NKormanik</dc:creator>
    <dc:date>2012-06-14T06:00:10Z</dc:date>
    <item>
      <title>How to use "labels" (Excel column headers) instead of SAS "names" when plotting?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-quot-labels-quot-Excel-column-headers-instead-of-SAS/m-p/82627#M256737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I imported into SAS an Excel spreadsheet successfully.&amp;nbsp; SAS, however, decided to create a "name" for each column of data, in addition to maintaining "label" for each column.&amp;nbsp; The "labels" correctly correspond to column headings in the original Excel file.&amp;nbsp; The SAS "names," however, are different from these "labels" -- apparently converted to SAS-speak.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When it comes time to plot a graph, SAS wants me to use the "names" it created, as opposed to the "labels."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This gets really confusing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to use "labels" in a plot statement, as opposed to "names"?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Solution greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nicholas Kormanik&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-email-small" href="mailto:nkormanik@gmail.com"&gt;nkormanik@gmail.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Code example using variable "names":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc gcontour data=smoothed;&lt;/P&gt;&lt;P&gt;plot _0801*_1301=_05010&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2012 06:00:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-quot-labels-quot-Excel-column-headers-instead-of-SAS/m-p/82627#M256737</guid>
      <dc:creator>NKormanik</dc:creator>
      <dc:date>2012-06-14T06:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to use "labels" (Excel column headers) instead of SAS "names" when plotting?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-quot-labels-quot-Excel-column-headers-instead-of-SAS/m-p/82628#M256738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;I imported into SAS an Excel spreadsheet successfully. &lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;The answer to your question depends on how you did this import.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you used PROC IMPORT, then you might want to turn on GETNAMES=YES; (although I thought it was the default). This should take the first row of the Excel spreadsheet and make it the SAS variable name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you used other methods for importing the spreadsheet, let us know, there is most likely a way to address this issue for other methods of importing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2012 13:03:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-quot-labels-quot-Excel-column-headers-instead-of-SAS/m-p/82628#M256738</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2012-06-14T13:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to use "labels" (Excel column headers) instead of SAS "names" when plotting?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-quot-labels-quot-Excel-column-headers-instead-of-SAS/m-p/82629#M256739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your column headers contain blanks or are repeated or are too long then SAS has to change them into valid SAS variable names&lt;/P&gt;&lt;P&gt;e.g. COLUMN HEADER will become COLUMN_HEADER or TYPE used in 3 columns will result in 3 variables called TYPE, TYPE1 and TYPE2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe most procedures will by default use Labels rather than Names&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2012 14:06:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-quot-labels-quot-Excel-column-headers-instead-of-SAS/m-p/82629#M256739</guid>
      <dc:creator>ChrisSelley</dc:creator>
      <dc:date>2012-06-14T14:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to use "labels" (Excel column headers) instead of SAS "names" when plotting?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-quot-labels-quot-Excel-column-headers-instead-of-SAS/m-p/82630#M256740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe the OP is wanting to use the label instead of variable name in the PLOT statement. Which generally is not going to work in any procedures.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suspect the only way Nicholas will be perfectly satisfied would be to have Excel column headers that are also acceptable SAS variable names.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2012 14:31:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-quot-labels-quot-Excel-column-headers-instead-of-SAS/m-p/82630#M256740</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2012-06-14T14:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to use "labels" (Excel column headers) instead of SAS "names" when plotting?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-quot-labels-quot-Excel-column-headers-instead-of-SAS/m-p/82631#M256741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks ballardw.&amp;nbsp; Correct thinking.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After further searching for the answer..., the Excel column headers being imported into SAS can avoid the SAS-speak transformation if one uses the following prior to the import step:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options validvarname=any;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using said option allows SAS to use pretty much whatever Excel column names one has -- including names with only numbers, names including spaces between words, etc. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the import..., one can check the properties of the new SAS data file, and all the "names" should be identical to the "labels".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then when it's time for the plotting step...&amp;nbsp; not entirely sure why, but it seems necessary to use the following form of code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plot '20801'n * '21301'n = '50501'n&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simply using --- plot 20801 * 21301 = 50501 --- doesn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Strange how SAS documentation generally blithely shows --- plot x * y = z.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yeah, right.&amp;nbsp; Not that easy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nicholas Kormanik&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-email-small" href="mailto:nkormanik@gmail.com"&gt;nkormanik@gmail.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2012 20:49:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-quot-labels-quot-Excel-column-headers-instead-of-SAS/m-p/82631#M256741</guid>
      <dc:creator>NKormanik</dc:creator>
      <dc:date>2012-06-14T20:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to use "labels" (Excel column headers) instead of SAS "names" when plotting?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-quot-labels-quot-Excel-column-headers-instead-of-SAS/m-p/82632#M256742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How would SAS know that 20801 and 21301 aren't numbers but variables? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In some cases this is obvious and others not so much, ie is my_variable= other_variable but if the other_variable name is 20801 how would it know how to interpret that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the full descriptive names but then you're stuck using the literal notation, ie 'variable name'n. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using labels instead is easier in my opinion. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2012 22:54:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-quot-labels-quot-Excel-column-headers-instead-of-SAS/m-p/82632#M256742</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-06-14T22:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to use "labels" (Excel column headers) instead of SAS "names" when plotting?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-quot-labels-quot-Excel-column-headers-instead-of-SAS/m-p/82633#M256743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent point, Reeza.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please tell us how to use "labels" instead?&amp;nbsp; Especially if it's easier.&amp;nbsp; Sure hope so.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2012 00:14:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-quot-labels-quot-Excel-column-headers-instead-of-SAS/m-p/82633#M256743</guid>
      <dc:creator>NKormanik</dc:creator>
      <dc:date>2012-06-15T00:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to use "labels" (Excel column headers) instead of SAS "names" when plotting?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-quot-labels-quot-Excel-column-headers-instead-of-SAS/m-p/82634#M256744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nicholas,&lt;/P&gt;&lt;P&gt;One way to "use" the labels instead of variable "name" is to rename you variables name with the label. For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*below, using SQL you can write a snippet of code that basically translates to this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = label, and this statement will be repeated for all your variables */&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select catt(name,"=", Label)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; into: new_label separated by " "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dictionary.columns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname = "&lt;STRONG&gt;WORK&lt;/STRONG&gt;" &amp;amp; memname = "&lt;STRONG&gt;YOUR_DATA&lt;/STRONG&gt;" &lt;STRONG&gt;;*note the uppercase needs to be uppercase;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*you can now automatically rename all your variables to their correspondent label;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set YOUR_DATA;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rename &amp;amp;new_label.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HOWEVER&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if your labels contain character like &amp;gt;, &amp;lt; {}...whatever special characters then you will need to tell SAS to replace those characters.&lt;/P&gt;&lt;P&gt;I learn that Regular Expressions (PRXchange) works wonderful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyhow...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best of luck!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anca.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2013 13:04:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-quot-labels-quot-Excel-column-headers-instead-of-SAS/m-p/82634#M256744</guid>
      <dc:creator>AncaTilea</dc:creator>
      <dc:date>2013-01-10T13:04:16Z</dc:date>
    </item>
  </channel>
</rss>

