<?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: formatted variables not accepting format label value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/formatted-variables-not-accepting-format-label-value/m-p/342998#M78678</link>
    <description>&lt;P&gt;Art,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think that your test shows this combination of factors at work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The PUT statement uses a character value for the first argument, but a numeric format in the second argument.&lt;/LI&gt;
&lt;LI&gt;To make the types match, SAS automatically assumes it should look for that format name with a $ in front of it.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;You could try the same program, but removing the dollar sign here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;retain fmtname 'CPT2CSSz';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would expect you get an error because there is no $CPT2CSSz format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At any rate, at least there's an explanation for there being no error message in the original post.&lt;/P&gt;</description>
    <pubDate>Tue, 21 Mar 2017 17:05:36 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-03-21T17:05:36Z</dc:date>
    <item>
      <title>formatted variables not accepting format label value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatted-variables-not-accepting-format-label-value/m-p/342981#M78669</link>
      <description>&lt;P&gt;I created a user defined format using the cntlin method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; aa.cpt_ccs_desc_fmt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;SET&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; aa.cpt_ccs_desc_file;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;RETAIN&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; FMTNAME &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'$CPT2CSSD'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;RENAME&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; CCS = START CCS_Label = LABEL;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;FORMAT&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;library&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=library &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;CNTLIN&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=aa.cpt_ccs_desc_fmt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;The results look like this:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG title="FORMAT NAME dollarsignCPT2CSS.png" alt="FORMAT NAME dollarsignCPT2CSS.png" src="https://communities.sas.com/t5/image/serverpage/image-id/7858i55199E7072CEE807/image-size/original?v=1.0&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when I run the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;7    DATA aa.apd_op_1stqtr16_w_proc_grp_desc;
8    SET aa.apd_op_1stqtr16_w_proc_grp_freq;
9    length proc_grp_desc $ 30;
10   proc_grp_desc = put(procedure_group,$cpt2cssd.);
11   RUN;

NOTE: There were 16688 observations read from the data set AA.APD_OP_1STQTR16_W_PROC_GRP_FREQ.
NOTE: The data set AA.APD_OP_1STQTR16_W_PROC_GRP_DESC has 16688 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.06 seconds
      cpu time            0.01 seconds&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;My data looks like the following.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG title="proc_grp_desc_data.png" alt="proc_grp_desc_data.png" src="https://communities.sas.com/t5/image/serverpage/image-id/7861i16B5FB74D132C23B/image-size/original?v=1.0&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;&lt;P&gt;I would like the proc_grp_desc variable to assume the value of the format $cpt2cssd. label.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also tried doing this with a numberic format with similar results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;54 DATA aa.apd_op_1stqtr16_w_proc_grp_desc;
55 SET aa.apd_op_1stqtr16_w_proc_grp_freq;
56 length proc_grp_desc $ 30;
57 proc_grp_desc = put(procedure_group, cpt2cssd.);
58 RUN;
NOTE: There were 16688 observations read from the data set AA.APD_OP_1STQTR16_W_PROC_GRP_FREQ.
NOTE: The data set AA.APD_OP_1STQTR16_W_PROC_GRP_DESC has 16688 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Same data as shown above.&lt;/P&gt;&lt;P&gt;Does anyone have a better approach. Should I build the format using the traditional PROC FORMAT; VALUE this = that; RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Stephen Dybas&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 16:00:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatted-variables-not-accepting-format-label-value/m-p/342981#M78669</guid>
      <dc:creator>no_hassles</dc:creator>
      <dc:date>2017-03-21T16:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: formatted variables not accepting format label value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatted-variables-not-accepting-format-label-value/m-p/342988#M78672</link>
      <description>&lt;P&gt;First thing to check:&amp;nbsp; can your program locate the proper format.&amp;nbsp; Since you are storing this format within the LIBRARY catalog, you must make the format available to the program by specifying:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;options fmtsearch=LIBRARY;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this is already in effect, then the problem becomes much messier.&amp;nbsp; For example, there might be unprintable characters (within either the data or the format) such as hex nulls instead of blanks that result in a match not being found.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note, there might be a format with the same name in the WORK format library.&amp;nbsp; That needs to be explored and eliminated as a possibility.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, it seems very strange that you could run with either the numeric or the character format on the same variable, and not get an error message.&amp;nbsp; Are you showing all the log notes?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 16:22:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatted-variables-not-accepting-format-label-value/m-p/342988#M78672</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-03-21T16:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: formatted variables not accepting format label value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatted-variables-not-accepting-format-label-value/m-p/342994#M78676</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;: My guess is that you're correct in thinking it's the 'library' specification.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However I, too, was surprised about the use of a numeric format for a character variable. However, to my surprise, the following worked:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data cpt_ccs_desc_file;
  informat ccs $3.;
  informat ccs_label $30.;
  input ccs ccs_label &amp;amp;;
  cards;
211 Therapeutic Radiology
213 Physical Therapy Exercises, Manipulation
;

DATA cpt_ccs_desc_fmt;
  SET cpt_ccs_desc_file;
  RETAIN FMTNAME '$CPT2CSSz';
  RENAME CCS = START CCS_Label = LABEL /*type 'C'*/;
RUN;

PROC FORMAT library=work CNTLIN=cpt_ccs_desc_fmt;
RUN;


data have;
  input procedure_group $;
  cards;
211  
213  
219  
;
data want;
  set have;
  length proc_grp_desc $ 30;
  proc_grp_desc = put(procedure_group, cpt2cssz.);
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 16:49:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatted-variables-not-accepting-format-label-value/m-p/342994#M78676</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-21T16:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: formatted variables not accepting format label value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatted-variables-not-accepting-format-label-value/m-p/342998#M78678</link>
      <description>&lt;P&gt;Art,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think that your test shows this combination of factors at work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The PUT statement uses a character value for the first argument, but a numeric format in the second argument.&lt;/LI&gt;
&lt;LI&gt;To make the types match, SAS automatically assumes it should look for that format name with a $ in front of it.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;You could try the same program, but removing the dollar sign here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;retain fmtname 'CPT2CSSz';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would expect you get an error because there is no $CPT2CSSz format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At any rate, at least there's an explanation for there being no error message in the original post.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 17:05:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatted-variables-not-accepting-format-label-value/m-p/342998#M78678</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-03-21T17:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: formatted variables not accepting format label value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatted-variables-not-accepting-format-label-value/m-p/343018#M78683</link>
      <description>&lt;P&gt;Thank you everyone for your responces. I will carefully look at each one and develop a solutions to my issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Update:&lt;/P&gt;&lt;P&gt;I noticed that I built a numeric format while I thought I was building a character format. I changed my numeric start value to character start values and I was able to match values by the correct type and assign the format label to my new variable name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Stephen Dybas&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 19:05:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatted-variables-not-accepting-format-label-value/m-p/343018#M78683</guid>
      <dc:creator>no_hassles</dc:creator>
      <dc:date>2017-03-21T19:05:43Z</dc:date>
    </item>
  </channel>
</rss>

