<?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 Proc format truncation of values in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-format-truncation-of-values/m-p/351226#M63898</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The formatted values were gettng truncated to a length of 20, when the data have the values which were not covered in below expected values.&lt;/P&gt;
&lt;P&gt;Ex: Raw data: "Once every 6 months in 2 cycles 15 days apart", which is not present in the proc format.&lt;/P&gt;
&lt;P&gt;Formatted value: "Once every 6 months" instead of full length value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please help on this.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;PROC FORMAT LIBRARY=work;&lt;BR /&gt;&amp;nbsp;Value $CMFREQ&lt;/P&gt;
&lt;P&gt;&amp;nbsp;"1"&amp;nbsp;=&amp;nbsp;"BID"&lt;BR /&gt;&amp;nbsp;"2"&amp;nbsp;=&amp;nbsp;"TID"&lt;BR /&gt;&amp;nbsp;"3"&amp;nbsp;=&amp;nbsp;"QID"&lt;BR /&gt;&amp;nbsp;"4"&amp;nbsp;=&amp;nbsp;"QD"&lt;BR /&gt;&amp;nbsp;"5"&amp;nbsp;=&amp;nbsp;"QM"&lt;BR /&gt;&amp;nbsp;"6"&amp;nbsp;=&amp;nbsp;"PRN"&lt;BR /&gt;&amp;nbsp;"7"&amp;nbsp;=&amp;nbsp;"Twice in the morning"&lt;BR /&gt;&amp;nbsp;"8"&amp;nbsp;=&amp;nbsp;"Twice in the evening"&lt;BR /&gt;&amp;nbsp;"9"&amp;nbsp;=&amp;nbsp;"Before meals"&lt;BR /&gt;"Q 6 months"= "Q6M"&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data cm;&lt;BR /&gt;length cmfreq $100.;&lt;BR /&gt;set raw.cm;&lt;BR /&gt;where cmfreqot ne '';&lt;BR /&gt;cmfreq = put(cmfreqot, $CMFREQ.);&lt;/P&gt;
&lt;P&gt;keep cmfreqot cmfreq;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Wed, 19 Apr 2017 11:05:19 GMT</pubDate>
    <dc:creator>devarayalu</dc:creator>
    <dc:date>2017-04-19T11:05:19Z</dc:date>
    <item>
      <title>Proc format truncation of values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-format-truncation-of-values/m-p/351226#M63898</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The formatted values were gettng truncated to a length of 20, when the data have the values which were not covered in below expected values.&lt;/P&gt;
&lt;P&gt;Ex: Raw data: "Once every 6 months in 2 cycles 15 days apart", which is not present in the proc format.&lt;/P&gt;
&lt;P&gt;Formatted value: "Once every 6 months" instead of full length value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please help on this.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;PROC FORMAT LIBRARY=work;&lt;BR /&gt;&amp;nbsp;Value $CMFREQ&lt;/P&gt;
&lt;P&gt;&amp;nbsp;"1"&amp;nbsp;=&amp;nbsp;"BID"&lt;BR /&gt;&amp;nbsp;"2"&amp;nbsp;=&amp;nbsp;"TID"&lt;BR /&gt;&amp;nbsp;"3"&amp;nbsp;=&amp;nbsp;"QID"&lt;BR /&gt;&amp;nbsp;"4"&amp;nbsp;=&amp;nbsp;"QD"&lt;BR /&gt;&amp;nbsp;"5"&amp;nbsp;=&amp;nbsp;"QM"&lt;BR /&gt;&amp;nbsp;"6"&amp;nbsp;=&amp;nbsp;"PRN"&lt;BR /&gt;&amp;nbsp;"7"&amp;nbsp;=&amp;nbsp;"Twice in the morning"&lt;BR /&gt;&amp;nbsp;"8"&amp;nbsp;=&amp;nbsp;"Twice in the evening"&lt;BR /&gt;&amp;nbsp;"9"&amp;nbsp;=&amp;nbsp;"Before meals"&lt;BR /&gt;"Q 6 months"= "Q6M"&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data cm;&lt;BR /&gt;length cmfreq $100.;&lt;BR /&gt;set raw.cm;&lt;BR /&gt;where cmfreqot ne '';&lt;BR /&gt;cmfreq = put(cmfreqot, $CMFREQ.);&lt;/P&gt;
&lt;P&gt;keep cmfreqot cmfreq;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 11:05:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-format-truncation-of-values/m-p/351226#M63898</guid>
      <dc:creator>devarayalu</dc:creator>
      <dc:date>2017-04-19T11:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: Proc format truncation of values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-format-truncation-of-values/m-p/351231#M63899</link>
      <description>&lt;P&gt;Yes, tricky one. &amp;nbsp;Had to think about it for a while. &amp;nbsp;Simplest way is to put other= and specify the format:&lt;/P&gt;
&lt;PRE&gt;proc format library=work;
 value $cmfreq
    "1" = "BID"
    "2" = "TID"
    "3" = "QID"
    other=[$100.]
    ;
run;

data cm;
  length cmfreq cmfreqtot $100.;
  infile datalines dlm="¬" missover;
  input cmfreqtot $;
  cmfreq=put(cmfreqtot, $CMFREQ.);
datalines;
3
A really long string which should push the twenty character bounds
;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Apr 2017 11:46:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-format-truncation-of-values/m-p/351231#M63899</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-04-19T11:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: Proc format truncation of values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-format-truncation-of-values/m-p/351234#M63900</link>
      <description>&lt;P&gt;You can define a default width when you define the format.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC FORMAT LIBRARY=work;
 value $CMFREQ (default=100) 
 "1" = "BID"
 "2" = "TID"
 "3" = "QID"
 "4" = "QD"
 "5" = "QM"
 "6" = "PRN"
 "7" = "Twice in the morning"
 "8" = "Twice in the evening"
 "9" = "Before meals"
 "Q 6 months"= "Q6M"
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or you can specify the width when you use the format.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cmfreq = put(cmfreqot, $CMFREQ100.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Apr 2017 11:54:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-format-truncation-of-values/m-p/351234#M63900</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-04-19T11:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: Proc format truncation of values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-format-truncation-of-values/m-p/351235#M63901</link>
      <description>&lt;P&gt;Many Thanks for your swift response. Issue solved now.&lt;/P&gt;
&lt;P&gt;Much appreicated.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 11:55:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-format-truncation-of-values/m-p/351235#M63901</guid>
      <dc:creator>devarayalu</dc:creator>
      <dc:date>2017-04-19T11:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: Proc format truncation of values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-format-truncation-of-values/m-p/351238#M63902</link>
      <description>PLease try the default=100 in proc format&lt;BR /&gt;&lt;BR /&gt;like below &lt;BR /&gt;&lt;BR /&gt;PROC FORMAT LIBRARY=work;&lt;BR /&gt;&amp;nbsp;Value $CMFREQ (default=100)&lt;BR /&gt;&amp;nbsp;"1"&amp;nbsp;=&amp;nbsp;"BID"&lt;BR /&gt;&amp;nbsp;"2"&amp;nbsp;=&amp;nbsp;"TID"&lt;BR /&gt;&amp;nbsp;"3"&amp;nbsp;=&amp;nbsp;"QID"&lt;BR /&gt;&amp;nbsp;"4"&amp;nbsp;=&amp;nbsp;"QD"&lt;BR /&gt;&amp;nbsp;"5"&amp;nbsp;=&amp;nbsp;"QM"&lt;BR /&gt;&amp;nbsp;"6"&amp;nbsp;=&amp;nbsp;"PRN"&lt;BR /&gt;&amp;nbsp;"7"&amp;nbsp;=&amp;nbsp;"Twice in the morning"&lt;BR /&gt;&amp;nbsp;"8"&amp;nbsp;=&amp;nbsp;"Twice in the evening"&lt;BR /&gt;&amp;nbsp;"9"&amp;nbsp;=&amp;nbsp;"Before meals"&lt;BR /&gt;"Q 6 months"= "Q6M"&lt;BR /&gt;;&lt;BR /&gt;run;</description>
      <pubDate>Wed, 19 Apr 2017 12:03:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-format-truncation-of-values/m-p/351238#M63902</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-04-19T12:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: Proc format truncation of values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-format-truncation-of-values/m-p/351239#M63903</link>
      <description>&lt;PRE&gt;
cmfreq = put(cmfreqot, $CMFREQ100.);

&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Apr 2017 12:05:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-format-truncation-of-values/m-p/351239#M63903</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-04-19T12:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Proc format truncation of values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-format-truncation-of-values/m-p/351241#M63904</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another way would be, to specify the default length for the format. See sample below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format library=work;
 value $cmfreq (default=100)
    "1" = "BID"
    "2" = "TID"
    "3" = "QID"
    ;
run;

data cm;
  infile datalines dlm="¬" truncover;
  input cmfreqtot $100.;
  cmfreq=put(cmfreqtot, $CMFREQ.);
datalines;
3
2
1
A really long string which should push the twenty character bounds
abc
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 12:12:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-format-truncation-of-values/m-p/351241#M63904</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2017-04-19T12:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Proc format truncation of values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-format-truncation-of-values/m-p/351310#M63915</link>
      <description>&lt;P&gt;Thank you Jagadish&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 14:05:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-format-truncation-of-values/m-p/351310#M63915</guid>
      <dc:creator>devarayalu</dc:creator>
      <dc:date>2017-04-19T14:05:01Z</dc:date>
    </item>
  </channel>
</rss>

