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)

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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