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.
For clarification, this is not SAS Technical Support - that's a different (paid) channel, except maybe the wonderful and thought-provoking Cynthia...
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.
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.
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?
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.
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.