No announcement yet.

How to create columns for nonexistent data

  • Filter
  • Time
  • Show
Clear All
new posts

  • How to create columns for nonexistent data

    When creating a DZS Table, the ACROSS variable is a formatted variable and the formats express all the possible values that the ACROSS variable can take up in a the specific study. When the data does not contain all the possible ACROSS variables the table will not create columns for the missing values. There is a way to get the missing columns into the table by taking the following steps:

    Let's assume that our ACROSS variable is treatment group for the DZSTable Macro call.
    1. Add a new variable to the original input data set - FAKE=missing.
    [FONT=Verdana]data inputData; set inputData;[/FONT]

    2. Create an additional data set with ALL possible treatment groups as an observation adding the variable FAKE=1 also
    data add; set inputData(obs=1);
    trtn=1; output;
    trtn=2; output;
    trtn=3; output;
    trtn=4; output;
    3. Append the additional data set to the input data set:
    data inputData; set inputData add; 
      format trtn trtn.
    4. Run the DZSTABLE macro with the variable FAKE as a title paging variable. The table will have an additional page containing all the ACROSS columns and FAKE=1 in the title. Using the default option UNIFORMACROSS will produce identical pages with all columns.
    (titles=%str(Example for more ACROSS treatment columns then data set has\!fake\@)

    5. Eliminate the extra page using MPREGEN=MYMAC.
    %macro mymac;
      data _statout; set _statout; if fake=.; run;
    %mend mymac;
    Click SampleAcrossFull.sasto see an example of a program that creates

    ClickSampleAcrossFull.doc to see the output of the example program.
    Last edited by Stella Scafidi; 03-31-2010, 11:36 AM.