04-03-2015 10:04 PM
Hi ~ I'm learning the PROC FORMAT CNTLIN part, but have some troubles if the data having multiple labels ...
For example :
IF Code 101,102,103 are classified as A disease ; code 101 ,105 are classified as B disease
If the data sets are as followed
and wish after using proc format with CNTLIN function ;
the data set would be turned into
ID CODE Classifications
1 101 A
1 101 B
2 102 A
3 103 A
4 105 B
DATA test ;
INPUT ID 1 CODE $5-7;
INPUT CODE $1-3 DZ $5;
rename code=start dz=label;
retain fmtname "$dz" ;
PROC FORMAT CNTLIN=fmttest;run;
but it seems not work at all .. is it possible to use PROC FORMAT with CNTLIN with multiple label function in this way ?
Thanks a lot
04-04-2015 11:16 AM
I think you need to add the TYPE variable to your CNTLIN dataset since you are defining an character format instead of a numeric format.
Also the $ is not included in the value of FMTNAME.
Also sort the data by FTMNAME and START.
To see the data structure needed you should create a format using proc format and generate the CNTLOUT dataset and check how it looks.
04-04-2015 12:24 PM
I don't think you can get what you want with a format, since it won't expand the data to have multiple records.
You can with a SQL join though.
04-04-2015 01:54 PM
Using format with the put function is not a multi label application. Aggregation procedures such as means and tabulate are.
04-04-2015 02:55 PM
There is the multi label option with SAS Base SAS(R) 9.3 Procedures Guide, Second Edition
It is logical a doubled classification of the same variable values, avoiding the need for duplicated runs on the same data.
As the format originally is designed to recode one input to a single new output value your logical questions you started with does not make sense.
The input code look to be diagnostics that can belong to many diseases. Having many of those diagnostics not knowing the disease you could try to build a prediction model. That is total different logical process. What are you trying to do?
04-05-2015 06:47 AM
To get a Multi Label Format to "do anything" you need a multi label enabled procedure, Means/summary, tabulate and report are it I think.
Here is example using SUMMARY that counts and uses IDGROUP to show the values of CODE in each grouping.