If you specify a character SUBJECT= variable in the RANDOM statement in PROC QLIM, the following error message is issued in the log:
PROC QLIM proceeds, but the RANDOM statement is ignored.
To avoid this problem, use a numeric SUBJECT= variable. You can convert your character SUBJECT= variable to a numeric variable before running PROC QLIM.
If the character variable contains only numbers, use the INPUT function for the conversion. For an example, see SAS Note 24590, "Convert variable values from character to numeric or from numeric to character."
If the character variable contains characters, you can use either one of the following two methods to convert the character variable to a numeric variable. Following is an example demonstrating the two methods.
The following DATA step reads in the data. The ID variable is a character variable with character values 'A', 'B', 'C'. This variable is the SUBJECT = variable in PROC QLIM.
data a;
input id $ t y;
datalines;
A 1 25
A 2 32
A 3 67
A 4 25
A 5 34
B 1 31
B 2 50
B 3 15
B 4 82
B 5 28
C 1 23
C 2 25
C 3 56
C 4 65
;
run;
First sort the data by the character variable ID:
proc sort data=a;
by id;
run;
The following DATA step creates a numeric variable IDNUM, such that each unique number corresponds to one unique value of the character variable ID. With the BY statement, the FIRST.ID identifies the first observation within each ID, and the IDNUM variable is increased by 1 each time a new ID is encountered.
data b;
set a;
by id;
if first.id then idnum + 1;
run;
The PROC PRINT step displays the resulting data set.
proc print data=b;
run;
You can then specify SUBJECT=IDNUM in the RANDOM statement in PROC QLIM.
First, run the FREQ procedure to create a data set containing a list of the unique ID values:
proc freq data=a noprint;
tables ID / out=levels;
run;
Create a CNTLIN= data set for PROC FORMAT:
data levels;
set levels end=EOF;
rename ID=start;
label+1;
fmtname="idfmt";
type="C";
run;
Use PROC FORMAT to create a custom format that associates a unique integer with each level of the character variable:
proc format library=work cntlin=levels;
run;
Apply the format to create the numeric variable IDNUM:
data c;
set a;
idnum=put(id, $idfmt.);
run;
The PROC PRINT step displays the resulting data set.
proc print data=c;
run;
Finally, specify SUBJECT=IDNUM in the RANDOM statement in PROC QLIM.