BookmarkSubscribeRSS Feed
doctorxg
Calcite | Level 5

Does anybody have sample codes for tracking query status (open,closed, updated, answered etc) for recurring report in a clinical database? 

3 REPLIES 3
ballardw
Super User

Please expand on that question. What is open/close/whatever? A table, a report object? A variable in a data table?

 

It may help if you have data and specific questions to post some example data, please recode an sensitive variables and provide an example of desired output from that example data. If you have data in a SAS data set there are tools to turn your SAS data into data step code. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

doctorxg
Calcite | Level 5

Sorry, just trying to get sas codes examples on tracking clinical data query in a typical clinical database. 

TomKari
Onyx | Level 15

Well, @ballardw is expressing it exactly right, people need a little more information to go on.

 

However, here is the hypothetical simplest query that I can imagine, to give you an idea of what they look like:

 

/* Create a textual format for the status field */

proc format lib=work;

value STf

1 = "open"

2 = "closed"

3 = "updated"

4 = "answered"

;

run;

/* Create some test data */

data ClinicalData;

informat TreatmentDate date9.;

format TreatmentDate yymmdd10. TreatmentStatus STf.;

input TreatmentDate TreatmentStatus;

cards;

20Mar2017 2

20Mar2017 3

20Mar2017 2

21Mar2017 1

21Mar2017 2

21Mar2017 1

21Mar2017 4

22Mar2017 1

22Mar2017 3

22Mar2017 1

run;

/* A couple of sample queries */

/* Get the treatment status for a given date */

proc sql;

select TreatmentStatus, count(*)

from ClinicalData

where TreatmentDate = "21mar2017"d

group by TreatmentStatus

order by TreatmentStatus;

quit;

/* Get the treatment status by date */

proc sql;

select TreatmentDate, TreatmentStatus, count(*)

from ClinicalData

group by TreatmentDate, TreatmentStatus

order by TreatmentDate, TreatmentStatus;

quit;

 

 

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 connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1260 views
  • 0 likes
  • 3 in conversation