<?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: Proc Format problem - resolving values with PUT in UNIX in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-problem-resolving-values-with-PUT-in-UNIX/m-p/11054#M1177</link>
    <description>Cool tip, Scott - I haven't seen putlog before.  Bold elements are where I assume the prooblem is occuring.  Here's what it gives me...&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt;diag00&amp;gt;&lt;BR /&gt;
mt_sic=73 &lt;B&gt;mt_sic2=7389&lt;/B&gt; bin=13 enhanced_business_name=BO ENTERPRISES INC exec_primary_sic=&lt;BR /&gt;
abi_primary_sic=  db_primary_sic=73890000 dmi_csad_primary_sic=7389 nbd_sic_1_code=73890000&lt;BR /&gt;
eqf_sic=508400 mald_EXT1PRIMARYSIC=73890000 nbd_primary_sic=73890000 I=8 &lt;B&gt;mt_industry=7389&lt;/B&gt;&lt;BR /&gt;
Master_sic=I: Services &lt;B&gt;Master_sic2=not found&lt;/B&gt; _ERROR_=0 _N_=2</description>
    <pubDate>Wed, 25 Mar 2009 18:41:43 GMT</pubDate>
    <dc:creator>oliver_selwyn</dc:creator>
    <dc:date>2009-03-25T18:41:43Z</dc:date>
    <item>
      <title>Proc Format problem - resolving values with PUT in UNIX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-problem-resolving-values-with-PUT-in-UNIX/m-p/11052#M1175</link>
      <description>Hello, thank you in adavance for your time and insight into solving my problem.&lt;BR /&gt;
&lt;BR /&gt;
I am attempting to use a SAS FORMAT named $SICLONG. which I created using OSHA's SIC classifications.  I was suscessful in creating it using the proc format cntlin option and it is stored in my home directory in a UNIX environment.  I can also acess it with proc catalog and sucesssfully print it ubsing the following...&lt;BR /&gt;
&lt;BR /&gt;
proc format library = MYFMT.formats fmtlib; SELECT $SICLONG; run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
However, when I attempt to call $SICLONG. in my program it does not error out, but all the values all resolve to "not found" which is the last format class.  Interestingly, I also create a local proc format (named $sic.) which does resolve satisfactorily.  The program is long, so I'm attching the important elemts below.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
/**************************** PROGRAM ****************************/&lt;BR /&gt;
libname MYFMT '/home/oselw';&lt;BR /&gt;
OPTIONS FMTSEARCH=(MYFMT) obs=1000;&lt;BR /&gt;
&lt;BR /&gt;
proc format;&lt;BR /&gt;
value $sic &lt;BR /&gt;
    '01','02','07','08','09'='A: Agriculture, Forestry &amp;amp; Fishing'                                                                                                                           &lt;BR /&gt;
    '10','12','13','14'='B: Mining' &lt;BR /&gt;
    '15','16','17'='C:  Construction '                                         &lt;BR /&gt;
	/*... more classifications here*/&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data output_data_set;&lt;BR /&gt;
	set input_data_set;&lt;BR /&gt;
     	/*unrelated stuff*/     &lt;BR /&gt;
	mt_sic=substr(mt_industry,1,2);&lt;BR /&gt;
	mt_sic2=substr(mt_industry,1,4);&lt;BR /&gt;
	Master_sic=put(mt_sic, $sic.); /**** THIS WORKS*/&lt;BR /&gt;
	Master_sic2=put(mt_sic2, $SICLONG.); /**** THIS DOESNT WORK*/&lt;BR /&gt;
run;&lt;BR /&gt;
                                                                 &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
/**************************** OUTPUT ****************************/&lt;BR /&gt;
                                          The SAS System                                        12&lt;BR /&gt;
&lt;BR /&gt;
                                Contents of Catalog MYFMT.FORMATS&lt;BR /&gt;
&lt;BR /&gt;
              #    Name       Type               Create Date          Modified Date&lt;BR /&gt;
              ---------------------------------------------------------------------&lt;BR /&gt;
              1    INCOME     FORMAT      11MAR2009:12:09:35     11MAR2009:12:09:35&lt;BR /&gt;
              2    INCOME     FORMATC     11MAR2009:12:31:51     11MAR2009:12:31:51&lt;BR /&gt;
              3    SICLONG    FORMATC     06MAR2009:09:55:43     06MAR2009:09:55:43&lt;BR /&gt;
              4    SIC_LON    FORMATC     05MAR2009:14:15:18     05MAR2009:14:15:18&lt;BR /&gt;
&lt;BR /&gt;
                                 Contents of Catalog MYFMT.FORMATS&lt;BR /&gt;
&lt;BR /&gt;
                                                              Last     Last&lt;BR /&gt;
                                  Page    Block    Num of    Block    Block&lt;BR /&gt;
              #    Description    Size     Size    Blocks    Bytes     Size    Pages&lt;BR /&gt;
              ----------------------------------------------------------------------&lt;BR /&gt;
              1                   4096     4096       519     1684     2040      519&lt;BR /&gt;
              2                   4096     4096       393     1003     1020      393&lt;BR /&gt;
              3                   4096     4096         9     1098     1275        9&lt;BR /&gt;
              4                   4096     4096         9     1104     1275        9&lt;BR /&gt;
&amp;#12;&lt;BR /&gt;
                                          The SAS System                                        13&lt;BR /&gt;
&lt;BR /&gt;
           ----------------------------------------------------------------------------&lt;BR /&gt;
           |       FORMAT NAME: $SICLONG LENGTH:   60   NUMBER OF VALUES:  445        |&lt;BR /&gt;
           |   MIN LENGTH:   1  MAX LENGTH:  60  DEFAULT LENGTH  60  FUZZ:        0   |&lt;BR /&gt;
           |--------------------------------------------------------------------------|&lt;BR /&gt;
           |START           |END             |LABEL  (VER. 8.2     06MAR2009:09:55:43)|&lt;BR /&gt;
           |----------------+----------------+----------------------------------------|&lt;BR /&gt;
           |100             |100             |AGRICULTURAL PRODUCTION-CROPS           |&lt;BR /&gt;
           |200             |200             |AGRICULTURAL PROD-LIVESTOCK &amp;amp; ANIMAL SPE|&lt;BR /&gt;
           |700             |700             |AGRICULTURAL SERVICES                   |&lt;BR /&gt;
           |800             |800             |FORESTRY                                |&lt;BR /&gt;
           |900             |900             |FISHING, HUNTING AND TRAPPING           |&lt;BR /&gt;
           |1000            |1000            |METAL MINING                            |

Thanks Scott!  I don't have the comments in my program, but I appreciate the clarification for everyone who's looking!&lt;BR /&gt;
&lt;BR /&gt;
    &lt;BR /&gt;
Message was edited by: oliver_selwyn</description>
      <pubDate>Wed, 25 Mar 2009 18:02:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-problem-resolving-values-with-PUT-in-UNIX/m-p/11052#M1175</guid>
      <dc:creator>oliver_selwyn</dc:creator>
      <dc:date>2009-03-25T18:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Format problem - resolving values with PUT in UNIX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-problem-resolving-values-with-PUT-in-UNIX/m-p/11053#M1176</link>
      <description>One obvious item is your SAS comment syntax.  If you start the comment with an asterisk character, the comment will not be terminated until the next semi-colon -- you have an asterisk and slash which is treated as part of the comment.&lt;BR /&gt;
&lt;BR /&gt;
So, I would say that your code is not executing, which would be the cause of your symptom.&lt;BR /&gt;
&lt;BR /&gt;
Consider adding the following self-diagnosis statement in your program for debugging purposes:&lt;BR /&gt;
&lt;BR /&gt;
putlog '&amp;gt;diag00&amp;gt;' / _all_;&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 25 Mar 2009 18:18:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-problem-resolving-values-with-PUT-in-UNIX/m-p/11053#M1176</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-03-25T18:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Format problem - resolving values with PUT in UNIX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-problem-resolving-values-with-PUT-in-UNIX/m-p/11054#M1177</link>
      <description>Cool tip, Scott - I haven't seen putlog before.  Bold elements are where I assume the prooblem is occuring.  Here's what it gives me...&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt;diag00&amp;gt;&lt;BR /&gt;
mt_sic=73 &lt;B&gt;mt_sic2=7389&lt;/B&gt; bin=13 enhanced_business_name=BO ENTERPRISES INC exec_primary_sic=&lt;BR /&gt;
abi_primary_sic=  db_primary_sic=73890000 dmi_csad_primary_sic=7389 nbd_sic_1_code=73890000&lt;BR /&gt;
eqf_sic=508400 mald_EXT1PRIMARYSIC=73890000 nbd_primary_sic=73890000 I=8 &lt;B&gt;mt_industry=7389&lt;/B&gt;&lt;BR /&gt;
Master_sic=I: Services &lt;B&gt;Master_sic2=not found&lt;/B&gt; _ERROR_=0 _N_=2</description>
      <pubDate>Wed, 25 Mar 2009 18:41:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-problem-resolving-values-with-PUT-in-UNIX/m-p/11054#M1177</guid>
      <dc:creator>oliver_selwyn</dc:creator>
      <dc:date>2009-03-25T18:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Format problem - resolving values with PUT in UNIX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-problem-resolving-values-with-PUT-in-UNIX/m-p/11055#M1178</link>
      <description>The problem is probably with your crtlin dataset.  Looking at your output of $siclong, you may have trailing blanks in the ctrlin data and that may be causing the non-matches (It's a bit hard to see, there appear to be trailing blanks after all the codes, but not after all the text.)</description>
      <pubDate>Wed, 25 Mar 2009 20:45:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-problem-resolving-values-with-PUT-in-UNIX/m-p/11055#M1178</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2009-03-25T20:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Format problem - resolving values with PUT in UNIX</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-problem-resolving-values-with-PUT-in-UNIX/m-p/11056#M1179</link>
      <description>You really need to validate the content of your format - that's something only you can do, given the large size and the limits of this forum environment.&lt;BR /&gt;
&lt;BR /&gt;
One test to validate your SAS format is to unload it with PROC FORMAT and CNTLOUT= to a SAS file, for close inspection, as compared to your data file.  &lt;BR /&gt;
&lt;BR /&gt;
After doing a CONTENTS against the CNTLOUT= file to get familiar with it, review the SAS-generated variables START, LABEL, and HLO data values, to start, if you are working with explicit values in the format (rather than value ranges -- a bit more complicated).&lt;BR /&gt;
&lt;BR /&gt;
Then sort your two files and do a MERGE in a DATA step.  If you cannot get the MERGE to work, then you have some type of garbage in the format (determined from a PROC PRINT of START variable with a hex-type character display format.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 25 Mar 2009 21:09:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-problem-resolving-values-with-PUT-in-UNIX/m-p/11056#M1179</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-03-25T21:09:36Z</dc:date>
    </item>
  </channel>
</rss>

