Help using Base SAS procedures

Help with Proc Format

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 142
Accepted Solution

Help with Proc Format

Hi all-

I have a column that contains a question text response. When the preceding question is marked "other" you are asked to please explan what  "other" is. For all the questions where "other" was not marked a *99 in generated

The column looks like this:

Q15
*99
*99

*explanation sentence text text text text text of various lengths

*99
*99

*explanation sentence text text text text text of various lengths

*99
*99

*explanation sentence text text text text text of various lengths

*explanation sentence text text text text text of various lengths

I'm trying to use proc format to assign a value lable of "Skipped" to *99.

I would like the column to look like this:

Q15
Skipped

Skipped

*explanation sentence text text text text text of various lengths

Skipped
Skipped

*explanation sentence text text text text text of various lengths

Skipped
Skipped

*explanation sentence text text text text text of various lengths

*explanation sentence text text text text text of various lengths

This is the proc format statement I wrote:

proc format;

value  $other

'*99'='Skipped';

run;

When I apply the format, I don't get the result that I want. The explanations get cut off.

So, i get this.

Q15
Skipped
Skipped
*explan
Skipped
Skipped
*explan
Skipped
Skipped
*explan
*explan

Is there anyway i can modify the proc format statement  so the explanations don't get cut off and I can still assign a value label to *99?

Any help is greatly appreciated. Thanks.


Accepted Solutions
Solution
‎01-31-2012 11:08 PM
PROC Star
Posts: 7,363

Help with Proc Format

Matthew,

I can't test it tonight, but do you get what you want if you include the default option when specifying the format in proc format (see: http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473473.htm ) ?

View solution in original post


All Replies
Solution
‎01-31-2012 11:08 PM
PROC Star
Posts: 7,363

Help with Proc Format

Matthew,

I can't test it tonight, but do you get what you want if you include the default option when specifying the format in proc format (see: http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473473.htm ) ?

Frequent Contributor
Posts: 142

Help with Proc Format

Yes, that was what im looking for. Thanks Art.

Super Contributor
Posts: 276

Re: Help with Proc Format

There is a easy way to avoid this truncation..

you can use this code..

proc format;

value $test (default=50)

"*99"="*skipped";

run;

(In default= option you can specify length for the fomat)

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 155 views
  • 0 likes
  • 3 in conversation