<?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: Question about proc format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Question-about-proc-format/m-p/910396#M359026</link>
    <description>&lt;P&gt;Well, it's going to be difficult for us to test, since you have the data and we don't.&amp;nbsp; But here is something worth trying.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is possible the transposition has assigned a format of $3 for your output.&amp;nbsp; Examine the results with a PROC CONTENTS to verify that this is what is happening.&amp;nbsp; Then change the format by adding a line:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data &amp;amp;varc._final3;
set &amp;amp;varc._final2;
if &amp;amp;varc=" " then label="n";
format &amp;amp;varc col1 label $30.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is overkill, since you likely don't need all three variables formatted as $30.&amp;nbsp; It is also possible that this issue has to be addressed slightly earlier in your program.&amp;nbsp; If your investigation shows that to be the case, you might have to create data (using a DATA step) with fake data that we can use for testing purposes.&lt;/P&gt;
&lt;P&gt;But changing the format in the right place should put you on the right path.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Jan 2024 08:21:50 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2024-01-04T08:21:50Z</dc:date>
    <item>
      <title>Question about proc format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-proc-format/m-p/910391#M359023</link>
      <description>&lt;P&gt;Hi guys!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have a variable named 'becog,' and its value is 'second complete remission /third complete remission.' In the final output, I need to change them to '2nd' and '3rd.' So, I used the following format:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;proc format;
  value $remiss
    "SECOND COMPLETE REMISSION"="2nd"
    "THIRD COMPLETE REMISSION"="3rd";
run;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Up to this point, everything is fine. Now, I need to add a row at the top in the 'becog' column as a label, and this label should be 'Current remission status.' It's quite long, so I named the column for this label 'col1' and also renamed 'becog' to 'col1' so that they can be merged. However, the problem arises because I formatted 'becog' initially. After the merge, my label is automatically truncated to three characters, similar to the format. How can I modify them to merge correctly?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is what I want to output:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-01-04 at 1.04.31 AM.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92254i5182951BDFE44849/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-01-04 at 1.04.31 AM.png" alt="Screenshot 2024-01-04 at 1.04.31 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;that's what I get:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-01-04 at 1.03.55 AM.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92255i488BD1FAB90C6BD3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-01-04 at 1.03.55 AM.png" alt="Screenshot 2024-01-04 at 1.03.55 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;my code:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;%macro con_stat1(varc= , label= );
proc freq data=ADSL noprint;
  tables Trt01an *&amp;amp;varc / missing outpct out=&amp;amp;varc;
run;

proc freq data=ADSL noprint;
tables trt01an/missing out=&amp;amp;varc._n (drop=percent);
run;

data &amp;amp;varc._total1;
set &amp;amp;varc &amp;amp;varc._n;
by trt01an;
format &amp;amp;varc $&amp;amp;varc..;
run;

data &amp;amp;varc._total2(drop=pct_row count);
set &amp;amp;varc._total1;
length value $11. col1 $30.;
if &amp;amp;varc ne " " then do;
value=put(count,3.)|| "(" || put(pct_row,4.1)||"%)";
col1=strip(&amp;amp;varc);
end;
else if &amp;amp;varc eq " " then do;
value=put(count,3.);
col1=strip(-1);
end;
run;

proc sort data=&amp;amp;varc._total2;
by &amp;amp;varc;
run;

proc transpose data=&amp;amp;varc._total2
  out=&amp;amp;varc._final1 (drop=_name_)
  prefix=Trt;
  by col1;
  var value;
  id Trt01an;
run;

data label;
length col1 $30;
col1="&amp;amp;label";
run;

data &amp;amp;varc._final2;
set label &amp;amp;varc._final1 ;
run;

data &amp;amp;varc._final3;
set &amp;amp;varc._final2;
if &amp;amp;varc=" " then label="n";
run;

%mend;
%con_stat1(varc=remiss,label=Current remission Status Score);&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Jan 2024 07:39:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-proc-format/m-p/910391#M359023</guid>
      <dc:creator>Sikcion</dc:creator>
      <dc:date>2024-01-04T07:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: Question about proc format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-proc-format/m-p/910396#M359026</link>
      <description>&lt;P&gt;Well, it's going to be difficult for us to test, since you have the data and we don't.&amp;nbsp; But here is something worth trying.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is possible the transposition has assigned a format of $3 for your output.&amp;nbsp; Examine the results with a PROC CONTENTS to verify that this is what is happening.&amp;nbsp; Then change the format by adding a line:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data &amp;amp;varc._final3;
set &amp;amp;varc._final2;
if &amp;amp;varc=" " then label="n";
format &amp;amp;varc col1 label $30.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is overkill, since you likely don't need all three variables formatted as $30.&amp;nbsp; It is also possible that this issue has to be addressed slightly earlier in your program.&amp;nbsp; If your investigation shows that to be the case, you might have to create data (using a DATA step) with fake data that we can use for testing purposes.&lt;/P&gt;
&lt;P&gt;But changing the format in the right place should put you on the right path.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 08:21:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-proc-format/m-p/910396#M359026</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2024-01-04T08:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: Question about proc format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-proc-format/m-p/910402#M359028</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/446290"&gt;@Sikcion&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you should increase the default length of format $REMISS. in your PROC FORMAT step so that it matches the length of variable COL1:&lt;/P&gt;
&lt;PRE&gt;value $remiss &lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;(default=30)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 09:01:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-proc-format/m-p/910402#M359028</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-01-04T09:01:03Z</dc:date>
    </item>
    <item>
      <title>Re: Question about proc format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-proc-format/m-p/910409#M359030</link>
      <description>&lt;P&gt;This works!!! Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 09:52:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-proc-format/m-p/910409#M359030</guid>
      <dc:creator>Sikcion</dc:creator>
      <dc:date>2024-01-04T09:52:39Z</dc:date>
    </item>
  </channel>
</rss>

