BookmarkSubscribeRSS Feed
Dhana18
Obsidian | Level 7

Hi,

I need your help please.

 

I have this data set:

PATIENT ID   EVENT ID    TEST    RESULT     TEST SITE

1212              10002            NAATP        P        PHARYNGEAL

1212              10002            NAATR        N        RECTUM

1212              10002             HIV             N         BLOOD

1110               10003            NAATP        P          PHARYNGEAL

1110               10003            NAATP        P          PHARYNGEAL

1212              10004            NAATR        N        RECTUM

1212              10004             HIV             N         BLOOD

1110               10005            NAATP        P          PHARYNGEAL

1110               10005            NAATP        P          PHARYNGEAL

 

 

 And I want to flip this data set like this BY UNIQUE PATIENT AND HAVE THE TEST IN SEPARATE CATEGORIES

PATIENT ID   EVENT ID    NAATP     NAATR 

1212              10002            P                 N

 

 And I want to flip this data set like this BY EVENT ID

 

I NEED TO BE ABLE TO ANALYZE THE DATA BY PATIENT WHAT KIND OF TEST DONE AND THE TEST RESULT OF EACH TEST

AND I WANT TO BE ABLE TO ANALYZE BY EVENT ID  WHAT KIND OF TEST DONE AT THAT EVENT AND THE TEST RESULT OF EACH TEST

4 REPLIES 4
Astounding
PROC Star

How do you picture the results, for EVENT_ID 10003 and 10005?  There are two tests performed for each. But the way you designed the output, there is only one spot available to save two test results.

Dhana18
Obsidian | Level 7

I want to have all the tests and results of all tests. the out put I showed is just an example. 

Your help will be appreciated. 

ballardw
Super User

@Dhana18 wrote:

Hi,

I need your help please.

 

I have this data set:

PATIENT ID   EVENT ID    TEST    RESULT     TEST SITE

1212              10002            NAATP        P        PHARYNGEAL

1212              10002            NAATR        N        RECTUM

1212              10002             HIV             N         BLOOD

1110               10003            NAATP        P          PHARYNGEAL

1110               10003            NAATP        P          PHARYNGEAL

1212              10004            NAATR        N        RECTUM

1212              10004             HIV             N         BLOOD

1110               10005            NAATP        P          PHARYNGEAL

1110               10005            NAATP        P          PHARYNGEAL

 

 

 And I want to flip this data set like this BY UNIQUE PATIENT AND HAVE THE TEST IN SEPARATE CATEGORIES

PATIENT ID   EVENT ID    NAATP     NAATR 

1212              10002            P                 N

 

 And I want to flip this data set like this BY EVENT ID

 

I NEED TO BE ABLE TO ANALYZE THE DATA BY PATIENT WHAT KIND OF TEST DONE AND THE TEST RESULT OF EACH TEST

AND I WANT TO BE ABLE TO ANALYZE BY EVENT ID  WHAT KIND OF TEST DONE AT THAT EVENT AND THE TEST RESULT OF EACH TEST


What type of analysis? Your data is already set up in a form that works for most analysis.

For instance this would count results within patient event test and testsite.

proc tabulate data=have;
   class patientid eventid test testsite result;
   table patientid *eventid * test* testsite,
         result * n
         /misstext=' ';
run;

Of course I have no actual idea what your variable names may be as you have not provided that information.

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 602 views
  • 0 likes
  • 4 in conversation