How to re-structure (select) data in SAS -
I have a dataset like this:
is data; INPUT _USUBJID $ VISITNUM $ VISIT $; Leaves; 01/01 Visits 1 Screening 01/01 Visits 1 Screening 01/01 Visits 1 Screening 01/01 Visits 1 Rate 01/01 Visits 1 Rated 01/01 Visits 3 Baseline 2 01/01 Visits 3 Baseline 01/01 Visits 3 Rated 01 / 01 Visit 3 Rated 01/02 Visit 1 Screening 01/02 Visit 1 Screening 01/02 VISIT3 BASELINE2 01/02 VISIT3 BASELINE2; Run;
I need to reconfigure it:
want data; INPUT _USUBJID $ VISITNUM $ VISIT $; Leaves; 01/01 Visit 1 Rate 01/01 Visits 1 Rated 01/01 Visits 3 Rated 01/01 Visits 3 Rated 01/02 Visit 1 Screening 01/02 Visit 1 Screening 01/02 Visit 3 Baseline 2 01/02 Visit 3 Baseline 2 ; Run;
If there are both screening and rate values in a topic, then I need to remove the RETEST value for that topic. If there is no RETEST value in any topic, then I only need this visit (i.e., screening in this example, or Baseline 2).
I will do it in three steps:
- retest on a dataset _usubjid, add visualization and grab the associated values (called retest below)
- Lowering the restore pair from the original pair and the values that are included in the following are summoned (called below)
- Get the synchronized restore and no-rating values.
Example in SQL:
proc sql; Select table as retest * *, where to go = "RETEST"; Select as the host * except from (select different _usubjid, travel by near) (select different _usubjid, visitnum from retest) as left onetesters left on the onetesters included. _usubjid = has._usubjid and onetesters.visitnum = has.visitnum; You want to create a table like * from * RETAP union * Select All *; leave;
Comments
Post a Comment