BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Mgarret
Obsidian | Level 7

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.

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

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

3 REPLIES 3
art297
Opal | Level 21

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 ) ?

Mgarret
Obsidian | Level 7

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

kuridisanjeev
Quartz | Level 8

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)

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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