<?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: Export to Stata with uppercase variable names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Export-to-Stata-with-uppercase-variable-names/m-p/445219#M111536</link>
    <description>&lt;P&gt;I ended up using Stata to rename the variables. (rename *,upper). In this case it wasn't such a problem since I wanted everything uppercase. However, it is a shame that SAS doesn't write out the variables while keeping the case as defined in SAS. (Stata variable names are case sensitive so this is important).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Incidentally:&lt;/P&gt;&lt;P&gt;- the DBMS=Stata is not needed if the file type is .dta&lt;/P&gt;&lt;P&gt;- the label option in proc export replaces the variable name with SAS variable label. However, it also converts it to lower case!&lt;/P&gt;</description>
    <pubDate>Tue, 13 Mar 2018 16:18:00 GMT</pubDate>
    <dc:creator>BruceBrad</dc:creator>
    <dc:date>2018-03-13T16:18:00Z</dc:date>
    <item>
      <title>Export to Stata with uppercase variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-to-Stata-with-uppercase-variable-names/m-p/445018#M111473</link>
      <description>&lt;P&gt;I want to export a SAS file to a Stata file. The variable names are in upper case in SAS and I need them to be in upper case in the Stata file. Can this be done? The code below produces a stata file where the variable name is in lower case. (The validvarname option doesn't seem to have any impact).&lt;/P&gt;&lt;PRE&gt;options validvarname=upcase;
data test;
VAR = 1;
output;
run;
proc export data=test outfile="c:\temp\test.dta" replace;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Mar 2018 04:23:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-to-Stata-with-uppercase-variable-names/m-p/445018#M111473</guid>
      <dc:creator>BruceBrad</dc:creator>
      <dc:date>2018-03-13T04:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Stata with uppercase variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-to-Stata-with-uppercase-variable-names/m-p/445193#M111528</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12505"&gt;@BruceBrad&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I want to export a SAS file to a Stata file. The variable names are in upper case in SAS and I need them to be in upper case in the Stata file. Can this be done? The code below produces a stata file where the variable name is in lower case. (The validvarname option doesn't seem to have any impact).&lt;/P&gt;
&lt;PRE&gt;options validvarname=upcase;
data test;
VAR = 1;
output;
run;
proc export data=test outfile="c:\temp\test.dta" replace;
run;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The validvarname option controls how SAS data set names are built and I would not expect it to affect export to STATA.&lt;/P&gt;
&lt;P&gt;Note that&lt;/P&gt;
&lt;PRE&gt;options validvarname=upcase;
data test;
var= 1;
output;
run;&lt;/PRE&gt;
&lt;P&gt;creates the test data set with variable VAR (uppercase).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have to assume you forgot to include the DMBS=STATA option for proc export when posting and not during your actual test.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might try providing an upper case label in the SAS data set and use the Label option in proc export. I don't have STATA so can't see that makes a difference or not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or look for Stata equivalent of Proc Datasets to rename variables if case is actually important in Stata. I wouldn't be surprised if SAS explicitly uses lower case on export to stata for some reason.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another option would be 1) ensure the variable names in SAS are uppercase, 2) export to CSV and 3) then import to Stata&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 15:08:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-to-Stata-with-uppercase-variable-names/m-p/445193#M111528</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-13T15:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Stata with uppercase variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-to-Stata-with-uppercase-variable-names/m-p/445219#M111536</link>
      <description>&lt;P&gt;I ended up using Stata to rename the variables. (rename *,upper). In this case it wasn't such a problem since I wanted everything uppercase. However, it is a shame that SAS doesn't write out the variables while keeping the case as defined in SAS. (Stata variable names are case sensitive so this is important).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Incidentally:&lt;/P&gt;&lt;P&gt;- the DBMS=Stata is not needed if the file type is .dta&lt;/P&gt;&lt;P&gt;- the label option in proc export replaces the variable name with SAS variable label. However, it also converts it to lower case!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 16:18:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-to-Stata-with-uppercase-variable-names/m-p/445219#M111536</guid>
      <dc:creator>BruceBrad</dc:creator>
      <dc:date>2018-03-13T16:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Stata with uppercase variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-to-Stata-with-uppercase-variable-names/m-p/445280#M111559</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12505"&gt;@BruceBrad&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I ended up using Stata to rename the variables. (rename *,upper). In this case it wasn't such a problem since I wanted everything uppercase. However, it is a shame that SAS doesn't write out the variables while keeping the case as defined in SAS. (Stata variable names are case sensitive so this is important).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- the label option in proc export replaces the variable name with SAS variable label. However, it also converts it to lower case!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I suggest bringing this to the attention of Tech support and making a suggestion to address this issue of name case as well as putting a thread on the topic here: &lt;A href="https://communities.sas.com/t5/SASware-Ballot-Ideas/idb-p/sas_ideas" target="_blank"&gt;https://communities.sas.com/t5/SASware-Ballot-Ideas/idb-p/sas_ideas&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;- the DBMS=Stata is not needed if the file type is .dta&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Perhaps from dinosaur-like tendencies when it comes to file import, export or reading/writing with a data step I dot the I, cross the t and ensure that the delimiter I specify and dbms are specified even if a default might work. That way when I use or read the code a few years later I &lt;STRONG&gt;know&lt;/STRONG&gt; what the file formats involved actually were.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you search this forum you will find posts of the type that "I tried to import a CSV file but it didn't work." After several go-a-rounds it is finally revealed that the file named something.csv is delimited with ; or | or tab or not delimited at all but is fixed column. Another reason I get a bit leery of relying on filenames/extensions to determine type.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 19:49:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-to-Stata-with-uppercase-variable-names/m-p/445280#M111559</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-13T19:49:20Z</dc:date>
    </item>
  </channel>
</rss>

