<?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 Need some info in PROC format in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Need-some-info-in-PROC-format/m-p/69225#M19864</link>
    <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
   I need some info on the limit of length of character Variable used in PROC FORMAT Value statement. I have some data related to Health Risk Appraisal, where questions are very long (to 200 bytes max). I need to map these questions to a question code for each question in PROC FORMAT. Please let me know if any other way to do this other than in if statement in data step statement.&lt;BR /&gt;
&lt;BR /&gt;
thanks,</description>
    <pubDate>Thu, 18 Mar 2010 09:51:01 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-03-18T09:51:01Z</dc:date>
    <item>
      <title>Need some info in PROC format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-some-info-in-PROC-format/m-p/69225#M19864</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
   I need some info on the limit of length of character Variable used in PROC FORMAT Value statement. I have some data related to Health Risk Appraisal, where questions are very long (to 200 bytes max). I need to map these questions to a question code for each question in PROC FORMAT. Please let me know if any other way to do this other than in if statement in data step statement.&lt;BR /&gt;
&lt;BR /&gt;
thanks,</description>
      <pubDate>Thu, 18 Mar 2010 09:51:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-some-info-in-PROC-format/m-p/69225#M19864</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-03-18T09:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Need some info in PROC format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-some-info-in-PROC-format/m-p/69226#M19865</link>
      <description>Explore using PROC FORMAT with CNTLIN= to create your SAS format from a SAS input file.  The DOC has all the information you need.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Recommended Google advanced search arguments, this topic/post:&lt;BR /&gt;
&lt;BR /&gt;
proc format cntlin site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
proc format character format site:sas.com</description>
      <pubDate>Thu, 18 Mar 2010 10:17:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-some-info-in-PROC-format/m-p/69226#M19865</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-03-18T10:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: Need some info in PROC format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-some-info-in-PROC-format/m-p/69227#M19866</link>
      <description>hi Support,&lt;BR /&gt;
&lt;BR /&gt;
I have checked the documentation, but I am not sure how to refer the lookup value referred to the question in proc format.&lt;BR /&gt;
&lt;BR /&gt;
I read in all possible questions that I will be getting in the data and assigned a question code for each of the question (which was 250 byte long). I used PROC Format on dataset which had variables.&lt;BR /&gt;
&lt;BR /&gt;
My code is like this -&lt;BR /&gt;
&lt;BR /&gt;
data lookup ;&lt;BR /&gt;
 infile inp lrecl = 300 recfm = v delimiter = ',' end = eof dsd truncover ;&lt;BR /&gt;
&lt;BR /&gt;
 length questnin $250.&lt;BR /&gt;
    quesncd  $7.&lt;BR /&gt;
    questxtcd  $258.&lt;BR /&gt;
    ;&lt;BR /&gt;
  &lt;BR /&gt;
&lt;BR /&gt;
 input&lt;BR /&gt;
&lt;BR /&gt;
 questnin  $&lt;BR /&gt;
 quesncd  $&lt;BR /&gt;
;&lt;BR /&gt;
&lt;BR /&gt;
questxtcd =  Trim(quesncd) || '-' || Trim(questnin) ; &lt;BR /&gt;
&lt;BR /&gt;
start = questxtcd ;&lt;BR /&gt;
LABEL = 'KEEP' ;&lt;BR /&gt;
FMTNAME = '$queskey';&lt;BR /&gt;
&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
PROC SORT DATA = lookup OUT = FMTOUT  NODUPKEY ;&lt;BR /&gt;
BY start ;&lt;BR /&gt;
&lt;BR /&gt;
PROC FORMAT CNTLIN=FMTOUT;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
So when I read in my raw file - when I refer to CNTLIN format on the raw variable for question we are getting, I am not getting desired output. &lt;BR /&gt;
&lt;BR /&gt;
Say for example I have a question like this - "HOW MANY HOURS OF SLEEP DO YOU USUALLY GET AT NIGHT?"  where I gave QUEST1&lt;BR /&gt;
&lt;BR /&gt;
So when ever I encounter this question on data, I need to output Quest1 instead of that so long full question. Looks like my reference to PROC Fromat is not working -&lt;BR /&gt;
&lt;BR /&gt;
HA_QUES_TXT  = put(Trim(Left(HA_QUESTION_TEXT)),$QUESKEY.);&lt;BR /&gt;
&lt;BR /&gt;
HA_QUESTION_TEXT is variable in raw data that I am getting. &lt;BR /&gt;
&lt;BR /&gt;
Please let me know what else I need to take care to output value "QUEST1".&lt;BR /&gt;
&lt;BR /&gt;
thanks in Advance,&lt;BR /&gt;
LG</description>
      <pubDate>Thu, 18 Mar 2010 18:23:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-some-info-in-PROC-format/m-p/69227#M19866</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-03-18T18:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: Need some info in PROC format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-some-info-in-PROC-format/m-p/69228#M19867</link>
      <description>For clarification, this is not SAS Technical Support - that's a different (paid) channel, except maybe the wonderful and thought-provoking Cynthia...&lt;BR /&gt;
&lt;BR /&gt;
Your SAS code that builds the START variable must match exactly the SAS code that constructs the PUT function argument #1.....they do not appear to be consistent.&lt;BR /&gt;
&lt;BR /&gt;
So, for self-debugging, have you attempted to analyze the generated format, either with the PROC FORMAT FMTLIB parameter, or better yet, use CNTLOUT= to unload your format and do a PROC PRINT on the SAS-generated file specified on CNTLOUT.&lt;BR /&gt;
&lt;BR /&gt;
You mention something about "..I need to output Quest1..."  but you do not share allof your SAS DATA step code that uses HA_QUES_TXT -- the variable assigned from the PUT function.  A match-condition will result in a value of KEEP -- so what do you do then?&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 18 Mar 2010 19:29:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-some-info-in-PROC-format/m-p/69228#M19867</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-03-18T19:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: Need some info in PROC format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-some-info-in-PROC-format/m-p/69229#M19868</link>
      <description>Hi Sbb,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for response. It gave me some direction on how to approach, but not exactly what I needed. &lt;BR /&gt;
&lt;BR /&gt;
I thought Arg #1 after lookup to PROC FORMAT will result in the short form of Question. But that's not happening. not sure how to get this resolved.&lt;BR /&gt;
&lt;BR /&gt;
Any ideas would help me a lot and I appreciate it.&lt;BR /&gt;
&lt;BR /&gt;
thanks,&lt;BR /&gt;
LG</description>
      <pubDate>Fri, 19 Mar 2010 02:13:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-some-info-in-PROC-format/m-p/69229#M19868</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-03-19T02:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: Need some info in PROC format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-some-info-in-PROC-format/m-p/69230#M19869</link>
      <description>Possibly, if you want SAS to return the short-form (your words) on a "match condition", then you need to assign whatever you expect back with the LABEL variable, not the string "KEEP" which only identifies when you have a "match condition" but provides no relief to save some data back from the format.&lt;BR /&gt;
&lt;BR /&gt;
Also, with creating your CNTLIN= file, after you output the last observation (on END=EOF with the SET stmt), then you want one additional observation for the OTHER=  telling SAS what to return on a no-match condition.  The DOC explains this technical application / approach.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 19 Mar 2010 02:50:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-some-info-in-PROC-format/m-p/69230#M19869</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-03-19T02:50:57Z</dc:date>
    </item>
  </channel>
</rss>

