SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

SAS code examples for Query Status

Reply
New Contributor
Posts: 2

SAS code examples for Query Status

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

Super User
Posts: 10,500

Re: SAS code examples for Query Status

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.

New Contributor
Posts: 2

Re: SAS code examples for Query Status

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

PROC Star
Posts: 1,091

Re: SAS code examples for Query Status

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;

 

 

Ask a Question
Discussion stats
  • 3 replies
  • 182 views
  • 0 likes
  • 3 in conversation