Recently in the SAS Community Library: SAS' @BethEbersole reveals 4 steps to stop money laundering, solve law-enforcement cases, find missing children and more with SAS Visual Investigator.
Hi,
I need some help with writing a SAS code to handle the following scenario.
I have a data set that has multiple sites; each site has multiple patients; and each patient can have data of up to 7 days (one row represents one day). The data set has form start and save time. Data set is also setup to have no duplicates. First day data of each patient should always have the previous save and open time (both are user defined variables) as NULL. e.g., sr.1, 8, and 9 will have previous open and save time variables as NULL. And using these variables, I want to calculate the the following for each patient at a site:
number of hours a patient took between today's and yesterday's start times (i.e., from today's start to previous start) and
number of hours a patient took between today's open and yesterday's start times (i.e., from today's start to previous day save)
Sr.
PT
SITE
START_TIME
SAVE_TIME
1
001
01
4/9/2024 16:44
4/9/2024 16:46
2
001
01
4/10/2024 16:39
4/10/2024 16:40
3
001
01
4/11/2024 16:07
4/11/2024 16:08
4
001
01
4/12/2024 16:05
4/12/2024 16:06
5
001
01
4/13/2024 20:05
4/13/2024 20:06
6
001
01
4/14/2024 19:31
4/14/2024 19:52
7
001
01
4/15/2024 16:25
4/15/2024 16:25
8
002
01
4/15/2024 16:19
4/15/2024 16:20
9
003
01
4/15/2024 16:21
4/15/2024 16:22
10
002
02
4/3/2024 18:34
4/3/2024 18:41
11
002
02
4/4/2024 18:03
4/4/2024 18:09
12
002
02
4/6/2024 21:11
4/6/2024 21:14
13
002
02
4/6/2024 21:14
4/6/2024 21:16
14
002
02
4/7/2024 18:17
4/7/2024 18:20
15
002
02
4/8/2024 18:12
4/8/2024 18:14
16
002
02
4/9/2024 18:06
4/9/2024 18:08
17
004
02
4/5/2024 18:03
4/5/2024 18:10
18
004
02
4/6/2024 16:27
4/6/2024 16:32
19
004
02
4/7/2024 19:18
4/7/2024 19:22
20
004
02
4/8/2024 18:01
4/8/2024 18:07
21
004
02
4/9/2024 18:06
4/9/2024 18:16
22
004
02
4/10/2024 18:08
4/10/2024 18:10
23
004
02
4/11/2024 19:22
4/11/2024 19:26
24
005
02
4/8/2024 18:05
4/8/2024 18:07
25
005
02
4/9/2024 19:32
4/9/2024 19:34
26
005
02
4/10/2024 18:45
4/10/2024 18:47
27
005
02
4/11/2024 18:02
4/11/2024 18:04
28
005
02
4/12/2024 18:04
4/12/2024 18:07
29
005
02
4/13/2024 18:01
4/13/2024 18:03
30
005
02
4/14/2024 18:06
4/14/2024 18:08
Thanks so much in advance for all the help.
... View more
Hi,
From this table:
DATA HAVE;
INPUT CODE TYPE$ CATEGORY$;
CARDS;
15 A Y6D
15 B K45
08 A LS7
08 B G27
63 A A09
63 A Q98
63 B Z98
05 A P09
10 A W87
;
RUN;
I would like to obtain the following result:
Thanks
... View more
How do I get more detail about the lines in BOLD? When I use option LISTOBS it will list the observations that it finds different. However when I view them I don't see any differences. How do I find out which vars are different when there are 95 vars? (Method=RELATIVE(0.0000222), Criterion=1.0E-09) Data Set Summary Dataset Created Modified NVar NObs ORDATA.ORACLETEMP 03MAY24:07:20:37 03MAY24:07:20:37 95 26553 SNOWDATA.SNOWTEMP 03MAY24:07:21:21 03MAY24:07:21:21 95 26553 Variables Summary Number of Variables in Common: 95. Number of ID Variables: 10. Number of Observations in Common: 24450. Number of Observations in ORDATA.ORACLETEMP but not in SNOWDATA.SNOWTEMP: 2103. Number of Observations in SNOWDATA.SNOWTEMP but not in ORDATA.ORACLETEMP: 2103. Total Number of Observations Read from ORDATA.ORACLETEMP: 26553. Total Number of Observations Read from SNOWDATA.SNOWTEMP: 26553. Number of Observations with Some Compared Variables Unequal: 0. Number of Observations with All Compared Variables Equal: 24450. Values Comparison Summary Number of Variables Compared with All Observations Equal: 85. Number of Variables Compared with Some Observations Unequal: 0. Total Number of Values which Compare Unequal: 0. Total Number of Values not EXACTLY Equal: 3628. Maximum Difference Criterion Value: 2.2094E-16. Here is my code: title "ordata.&ordsn versus &snowdsn"; proc compare base=ordata.&ordsn compare=snowdata.&snowdsn Criterion=0.000000001 fuzz=.001 out=result listobs outbase outcomp outdif outnoequal maxprint=50; id member medicaid_no claim_number line_number PAY_DT F_DOS L_DOS DOS AMT_REQ QTY ; attrib _all_ label=''; format _all_; informat _all_; run;
... View more
I have a report (e.g. below) where a set of list controls control the data used in the scatter plot and a simple univariate linear regression. The table below has some reference x values, and the "Predicted" column is derived from the linear regression (right click on object, "Derive predicted", and included as an item in the dataset, avg. aggregation.) The linear regression itself updates whenever I select/deselect any item in the controls. But the 'Predicted' values are the values from the initial version of the regression from which I created the field. Is there any way to get the predicted y values from the regression updating dynamically and displayed in the report below? It should change whenever I change the list control selection. I just want the report viewer to be able to see the estimated y values at certain x values as they slice data in different combinations. Thank you!
... View more