Hello,
Can anyone help me how can I use PROC PICTURE more efficiently for following kind of visit to assign format.
data test1;
length visit $200.;
input visit$1-15 visitnum 16-21;
datalines;
Screening 10
Cycle 01 Day 1 101
Cycle 02 Day 1 201
Cycle 03 Day 1 301
Cycle 04 Day 1 401
Cycle 05 Day 1 501
Cycle 06 Day 1 601
Cycle 07 Day 1 701
Cycle 08 Day 1 801
Cycle 09 Day 1 901
Unscheduled 1 999.01
Unscheduled 2 999.02
Unscheduled 3 999.03
Unscheduled 4 999.04
Unscheduled 5 999.05
Unscheduled 6 999.06
Unscheduled 7 999.07
Unscheduled 8 999.08
Unscheduled 9 999.09
Unscheduled 10 999.1
Unscheduled 12 999.12
Unscheduled 13 999.13
Unscheduled 17 999.17
Unscheduled 30 999.3
Cycle 10 Day 1 1001
Cycle 11 Day 1 1101
Cycle 12 Day 1 1201
Cycle 13 Day 1 1301
Cycle 14 Day 1 1401
Discontinuation 10090
;
run;
proc Format;
value $visit
10 = 'Screening'
101 = 'V01'
201 = 'V02'
301 = 'V03'
401 = 'V04'
501 = 'V05'
601 = 'V06'
701 = 'V07'
801 = 'V08'
901 = 'V09'
1001= 'V10'
1101= 'V11'
1201= 'V12'
1301= 'V13'
1401= 'V14'
1501= 'V15'
1601= 'V16'
1701= 'V17'
10090= 'EOT'
999.01 = 'U01'
999.02 = 'U02'
999.03 = 'U03'
999.04 = 'U04'
999.05 = 'U05'
999.06 = 'U06'
999.36 = 'U36'
;
run;
proc format lib=library;
picture visitwin (round)
10 = 'Screening' (noedit)
101 = 'V01' (noedit)
201 = 'V02' (noedit)
301 = 'V03' (noedit)
401 = 'V04' (noedit)
999.01 - 999.99 = 000.99 (prefix='U');
run;
I am not sure I understand what:
For example assigning “ U01” , “U02” etc. without “U999.01”,’U999.02’ etc. -- > I know this can be resolve by adding one extra step in data step, but is there any way to do in PROC format code.
really means. If you do not supply a range then Proc format generally displays any values out of the range using a default for type unless you use the OTHER range. So if you do not provide 999.01 - 999.99 (or what ever) in the ranges the values would display as Best12 or so values, 999.01 999.02 and so on.
For the second question are you looking for something like:
proc Format;
value $visit
10 = 'Screening'
101 - 109= 'V01'
201 - 209= 'V02'
<etc>
Rules are important as lists of examples do not always describe the situation as carefully.
If this is complex enough for range/rule combinations you may look at a Cntlin data set to build values with data step logic.
For example assigning “ U01” , “U02” etc. without “U999.01”,’U999.02’ etc. -- > I know this can be resolve by adding one extra step in data step, but is there any way to do in PROC format code.
really means ----- > it means when you use PROC format PICTURE it will give you result like “U999.01”,’U999.02 for range of unscheduled visit Please see example at following link https://www.pharmasug.org/proceedings/2012/IB/PharmaSUG-2012-IB07.pdf
@unnati wrote:
For example assigning “ U01” , “U02” etc. without “U999.01”,’U999.02’ etc. -- > I know this can be resolve by adding one extra step in data step, but is there any way to do in PROC format code.
really means ----- > it means when you use PROC format PICTURE it will give you result like “U999.01”,’U999.02 for range of unscheduled visit Please see example at following link https://www.pharmasug.org/proceedings/2012/IB/PharmaSUG-2012-IB07.pdf
Please don't bother describing what you don't want. Do describe what you do want / expect for output.
What am I supposed to be looking at in that link? Without knowing what you expect to show given specific values it really sin't clear what you want.
In discussing Proc Format that means you need to
1) define clearly the range(s) of values
2) the final appearance for those ranges.
You have mentioned "without “U999.01”,’U999.02’ etc." So what is input range and what is the expected appearance of the result? "Without" could mean 1) nothing at all is displayed such as a blank value 2) Values of U999.011 to U999.0199999 are acceptable but not the U999.01 and U999.02 (excluding ends of intervals) 3) display 999.01 instead of "U999.01" - don't specify a prefix at all.
Sorry if i am not able to explain my query correctly.
Result for unscheduled visit "without “U999.01”,’U999.02’ etc." means display "U01",'U02" etc. instead of "U999.01","U999.02" (excluding "999.")
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: