<?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 studio import excel file issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734399#M228794</link>
    <description>&lt;P&gt;Do you mean that you ran the second part without ever running the first part? (Or after restarting your SAS session that SAS/studio is using to run your SAS program code).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or are you saying that if you run that as two separate submissions in the same SAS/Studio session it works differently than when you submit the whole program at once?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the former then change the setting VALIDVARNAME to what you want in your AUTOEXEC file.&lt;/P&gt;
&lt;P&gt;If the later then check what code SAS/Studio is submitting before/after each submission of code in your editor window.&amp;nbsp; It must be resetting VALIDVARNAME in that code.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Apr 2021 18:30:57 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-04-15T18:30:57Z</dc:date>
    <item>
      <title>SAS studio import excel file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734394#M228790</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;The below is my code to import excel file with SAS studio. When I run step by step, the output variables had space, like 'Test A', 'Test B' (fig2 below). However, when I run all steps together, the output variables changed into "Test_A", 'Test_B' (fig. 3 below).&lt;/P&gt;
&lt;P&gt;My question is how I set up my SAS studio or revise my code to get fig.3 output when running the code step by step. Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;		 options validvarname=v7;   /*Step 1*/
		 
		 proc import datafile="...\test.xlsx" out = test dbms=xlsx replace;  /*step 2*/
		 	getnames=yes;
		 	sheet='Sheet1';
 		run;&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is&amp;nbsp;&lt;CODE class=" language-sas"&gt;test.xlsx&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="excel.JPG" style="width: 270px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57934i317B032B26DFF54B/image-dimensions/270x161?v=v2" width="270" height="161" role="button" title="excel.JPG" alt="excel.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Fig.2&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="f_1.JPG" style="width: 454px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57936i4FBD41A952372570/image-dimensions/454x159?v=v2" width="454" height="159" role="button" title="f_1.JPG" alt="f_1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Fig.3&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="f_2.JPG" style="width: 436px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57935i13AA60E88A8ADBCC/image-dimensions/436x147?v=v2" width="436" height="147" role="button" title="f_2.JPG" alt="f_2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 18:22:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734394#M228790</guid>
      <dc:creator>Niugg2010</dc:creator>
      <dc:date>2021-04-15T18:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: SAS studio import excel file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734396#M228792</link>
      <description>&lt;P&gt;When I used SAS EG or PC SAS, I never met above issue.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 18:27:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734396#M228792</guid>
      <dc:creator>Niugg2010</dc:creator>
      <dc:date>2021-04-15T18:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAS studio import excel file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734399#M228794</link>
      <description>&lt;P&gt;Do you mean that you ran the second part without ever running the first part? (Or after restarting your SAS session that SAS/studio is using to run your SAS program code).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or are you saying that if you run that as two separate submissions in the same SAS/Studio session it works differently than when you submit the whole program at once?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the former then change the setting VALIDVARNAME to what you want in your AUTOEXEC file.&lt;/P&gt;
&lt;P&gt;If the later then check what code SAS/Studio is submitting before/after each submission of code in your editor window.&amp;nbsp; It must be resetting VALIDVARNAME in that code.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 18:30:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734399#M228794</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-04-15T18:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: SAS studio import excel file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734407#M228797</link>
      <description>Your first line of code is key:&lt;BR /&gt;&lt;BR /&gt;Option VALIDVARNAME=V7. &lt;BR /&gt;&lt;BR /&gt;Studio and EG have the default set to ANY typically which allows spaces in naming. So if you run the code without that line it may be missing. You also need to verify that the version you're using is displaying either variable names or labels. These are controlled via settings and preferences and could very easily be different in different installations, which is why you may not have encountered this before if it's the first time you're switching between systems.</description>
      <pubDate>Thu, 15 Apr 2021 18:43:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734407#M228797</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-04-15T18:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: SAS studio import excel file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734416#M228800</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;It is strange and easy make errors, if the outputs are differences by running step by step or as a whole. I checked the preference in SAS studio page, and did not find somewhere I can change to remove this issue.&lt;/P&gt;
&lt;P&gt;What should I do to remove this kind of issue? Should I ask our IT department to reset the environment? Please advise. Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 19:11:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734416#M228800</guid>
      <dc:creator>Niugg2010</dc:creator>
      <dc:date>2021-04-15T19:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: SAS studio import excel file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734419#M228801</link>
      <description>&lt;P&gt;To some degree, If you run the exact same code, in the same system you should expect the same results.&lt;/P&gt;
&lt;P&gt;From the code shown, you shouldn't see a difference. You didn't show your full code so it's hard to tell where the difference is. If you feel there is a real difference between the two options, run it using one method and then run a proc contents on the file. Then do the same with the other methodology. They should be exactly the same.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would not expect the same results running on different systems with PROC IMPORT as it's a guessing procedures and by definition it can guess differently. If the file changes monthly you also cannot guarantee that you'll get the same results from month to month, as the data changes there's a small chance that SAS will read in columns with different types and formats.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In general, if you're automating a process it's rare to use PROC IMPORT as it's not consistent, import your data using a data step if you need that type of consistency.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 19:18:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734419#M228801</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-04-15T19:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAS studio import excel file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734439#M228802</link>
      <description>I submit the code separately. &lt;BR /&gt;Yes, you are right. If I submit together VALIDVARNAME keeping equal to V7. However, when I submit separately, VALIDVARNAME is reset as VALIDVARNAME=ANY.  &lt;BR /&gt;</description>
      <pubDate>Thu, 15 Apr 2021 19:28:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734439#M228802</guid>
      <dc:creator>Niugg2010</dc:creator>
      <dc:date>2021-04-15T19:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAS studio import excel file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734459#M228805</link>
      <description>&lt;P&gt;I run the code in the same environment and same session . The only difference is: one is I submitted separately and another is I submitted the code together. I checked the log by adding "proc options option=validvarname; run;" for the first way I got&amp;nbsp;validvarname=any, and for the second way I got&amp;nbsp;validvarname=v7. That is what I felt some strange.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 19:36:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734459#M228805</guid>
      <dc:creator>Niugg2010</dc:creator>
      <dc:date>2021-04-15T19:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: SAS studio import excel file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734488#M228806</link>
      <description>&lt;P&gt;To see what type of random code SAS/Studio is inserting you can change a preference setting.&lt;/P&gt;
&lt;P&gt;Check the "Show generated code in the SAS log" box.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 893px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57996iD30513C14D7EF341/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is also a setting "SAS variable name policy" that should change the validvarname option.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="image.png" style="width: 603px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58000iE99B310F64AAA735/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 19:53:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734488#M228806</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-04-15T19:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAS studio import excel file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734495#M228807</link>
      <description>I just checked and SAS Studio appears to run in batch, so when you submit your option it has to be in the same "submit" as your PROC IMPORT otherwise it switches back to ANY as soon as that "submission" is done. That's probably what you're seeing. I have no idea if that's a bug or expected behaviour. It is a change from what happened in EG/Base and not what I would expect to see either.....which is why I tested it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Under Preferences&amp;gt;Tables you can set the option as V7 or Any via the drop down. If your IT has turned off this setting for you, you may need to ask them to make the change instead. It may impact any other production code you have in place so this isn't' a minor change.</description>
      <pubDate>Thu, 15 Apr 2021 19:54:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734495#M228807</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-04-15T19:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: SAS studio import excel file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734498#M228808</link>
      <description>&lt;P&gt;Thanks a lot. I changed as you said. It works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 19:59:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-studio-import-excel-file-issue/m-p/734498#M228808</guid>
      <dc:creator>Niugg2010</dc:creator>
      <dc:date>2021-04-15T19:59:39Z</dc:date>
    </item>
  </channel>
</rss>

