<?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: Format character variables with proc dataset $upcase. in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Format-character-variables-with-proc-dataset-upcase/m-p/986482#M43812</link>
    <description>As Tom said your first question doesn't make any sense, if you need to do that ,you could change all these variable value into upcase by UPCASE() function.</description>
    <pubDate>Fri, 17 Apr 2026 06:41:16 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2026-04-17T06:41:16Z</dc:date>
    <item>
      <title>Format character variables with proc dataset $upcase.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Format-character-variables-with-proc-dataset-upcase/m-p/986466#M43810</link>
      <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm using the following code to format all my char variables so that they will appear as uppercase:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets lib=work nolist;
    modify mydb;
    format _character_ $upcase.;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;1) While doing proc contents, the $UPCASE appears. Is it possible to prevent it appears in "Format"? Empty will be ok.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) Is there a way to exclude a specific char variable to be formatted as "upcase"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that I used this code because I have many many variables and I cannot specify each one one by one.&lt;/P&gt;
&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2026 18:50:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Format-character-variables-with-proc-dataset-upcase/m-p/986466#M43810</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2026-04-16T18:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Format character variables with proc dataset $upcase.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Format-character-variables-with-proc-dataset-upcase/m-p/986468#M43811</link>
      <description>&lt;P&gt;Item (1) makes no sense.&amp;nbsp; If you want to attach the $UPCASE. format so that the values print in uppercase then the format is attached.&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For (2) just add a second FORMAT statement that lists the variables that you want to have NO format attached to them.&amp;nbsp; That will remove any format that they might have had attached.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example that removes the $UPCASE. format from the variable NAME.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets lib=work nolist;
  modify mydataset;
    format _character_ $upcase.;
    format name ;
  run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2026 19:16:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Format-character-variables-with-proc-dataset-upcase/m-p/986468#M43811</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-04-16T19:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: Format character variables with proc dataset $upcase.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Format-character-variables-with-proc-dataset-upcase/m-p/986482#M43812</link>
      <description>As Tom said your first question doesn't make any sense, if you need to do that ,you could change all these variable value into upcase by UPCASE() function.</description>
      <pubDate>Fri, 17 Apr 2026 06:41:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Format-character-variables-with-proc-dataset-upcase/m-p/986482#M43812</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2026-04-17T06:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: Format character variables with proc dataset $upcase.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Format-character-variables-with-proc-dataset-upcase/m-p/986500#M43813</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134532"&gt;@NewUsrStat&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm using the following code to format all my char variables so that they will appear as uppercase:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets lib=work nolist;
    modify mydb;
    format _character_ $upcase.;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;1) While doing proc contents, the $UPCASE appears. Is it possible to prevent it appears in "Format"? Empty will be ok.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) Is there a way to exclude a specific char variable to be formatted as "upcase"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that I used this code because I have many many variables and I cannot specify each one one by one.&lt;/P&gt;
&lt;P&gt;Thank you in advance&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;To your last point use some code generation instead so that you do not need to know the names of all of the variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example say you wanted to make a new dataset that converted all of the character variables except NAME to uppercase you could do something like this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents noprint data=mydb out=contents;
run;
filename code temp;
data _null_;
  set contents ;
  where type=2;
  where also upcase(name) ne 'NAME';
  file code;
  put name '=upcase(' name ');';
run;
data want;
  set mydb;
%include code / source2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note to protect for nonstandard variable names in case you are running with VALIDVARNAME=ANY then you could modify the data _NULL_ code to generate name literals instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  nliteral=nliteral(name);
  put nliteral '=upcase(' nliteral ');';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2026 15:56:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Format-character-variables-with-proc-dataset-upcase/m-p/986500#M43813</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-04-17T15:56:18Z</dc:date>
    </item>
  </channel>
</rss>

