I want to know how many clients in each clinic stayed at a different clinic and the cost of the stay at the different clinic. I am not considering order of the stays. I do not want to count a client if they have a different stay in the same clinic (see client L).
Thank you for your help!
data have;
input
client$ Span_Begin :DATE9. Span_End :DATE9. clinic$ stay cost;
format Span_Begin MMDDYY10. Span_End MMDDYY10. ;
datalines;
A 17Nov2022 04Jan2023 8 1 1373
B 01Jul2022 29Jul2022 12 1 2746
B 21Nov2022 04Apr2023 12 2 1373
C 01Jul2022 07Jul2022 8 1 2403
D 01Jul2022 12Jul2022 10 1 5479
E 01Jul2022 23Mar2023 9 1 159000
F 22Nov2022 19Mar2023 8 1 6522
G 26Aug2022 15May2023 12 1 687
H 01Oct2022 10Apr2023 6 1 5479
I 30Dec2022 19Jan2023 5 1 8675
J 01Jul2022 01Nov2022 3 1 4566
K 11Nov2022 10Jan2023 3 2 10044
L 01Jul2022 15Jul2022 3 3 9588
L 26Jul2022 17Aug2022 12 1 2060
L 23Sep2022 19Feb2023 12 1 5149
O 20Sep2022 20Feb2023 5 1 5022
P 01Jul2022 02Aug2022 5 1 913
Q 06Jul2022 01Sep2022 8 1 343
R 01Jul2022 01Sep2022 1 1 457
S 01Jul2022 24Oct2022 2 1 10957
T 01Jul2022 04Dec2022 2 1 1826
U 28Aug2022 18Sep2022 8 1 6179
V 19Dec2022 31May2023 7 2 10501
W 08Jun2023 18Jun2023 7 3 5022
X 01Jul2022 10Jul2022 8 1 3433
Y 04Aug2022 17Nov2022 10 2 7305
Z 13Oct2022 07Nov2022 8 1 2403
Z 09Feb2023 30Jun2023 12 2 5149
AA 08Sep2022 04Oct2022 8 1 2746
BB 01Jul2022 26Apr2023 2 1 10501
CC 09Aug2022 19Jun2023 12 1 1373
DD 01Jul2022 21Aug2022 10 1 9588
DD 17Oct2022 13Jun2023 11 2 5935
EE 01Jul2022 15Jul2022 5 1 3196
EE 26Jul2022 17Aug2022 5 2 7305
EE 23Sep2022 19Feb2023 4 3 13697
;;;
run;
Here are the results from the above example:
Clinic
Count
Cost
3
1
$9,588
4
1
$13,697
5
1
$10,501
8
1
$2,403
10
1
$9,588
11
1
$5,935
12
2
$12,358
Grand Total
8
$64,070
... View more
Join us for this 12-week series to prepare to take a Base Programming Certification exam. We'll cover the SAS Programming 1: Essentials and SAS Programming 2: Data Manipulation Techniques courses, as well as general exam preparation.
We’re excited to kick-off our series next week. We’ll meet every Wednesday from Sep 4 – Nov 20, 2024, 4:30 – 6:00 p.m. EST. Our weekly live online sessions will include demos, Q&A, and discussions. On your own schedule, complete e-learning videos and exercises. Attend at least eight live sessions and complete the e-learning to receive a free certification voucher!
Read more about this series here and register by 12 pm EST on Aug 30th, 2024.
As you navigate through the series, we encourage you to use this post to ask any questions and collaborate with other attendees.
... View more
Hello,
I have tried two different uncompress command and based on the log file, it seems two work. But I am unable to read the .dat file from work.
how to solve that issue.
%let path=/dwh_actuariat/sasdata/Data_Retention/sas2002/be;
filename oscmd pipe "uncompress -c &path./bel.prod0110.se8030ac.m525.dat.Z > &path./bel.prod0110.se8030ac.m525.dat 2>&1";
data _null_;
infile oscmd;
input;
put _infile_;
run;
%let work=%sysfunc(pathname(work));
%put &=work;
filename oscmd pipe "uncompress -c &path./bel.prod0110.se8030ac.m525.dat.Z > &work./bel.prod0110.se8030ac.m525.dat 2>&1";
data _null_;
infile oscmd;
input;
put _infile_;
run;
NOTE: Writing HTML5(EGHTML) Body file: EGHTML 28 29 %let path=/dwh_actuariat/sasdata/Data_Retention/sas2002/be; 30 filename oscmd pipe "uncompress -c &path./bel.prod0110.se8030ac.m525.dat.Z > &path./bel.prod0110.se8030ac.m525.dat 2>&1"; 31 32 data _null_; 33 infile oscmd; 34 input; 35 put _infile_; 36 run;
NOTE: The infile OSCMD is: Pipe command="uncompress -c /dwh_actuariat/sasdata/Data_Retention/sas2002/be/bel.prod0110.se8030ac.m525.dat.Z > /dwh_actuariat/sasdata/Data_Retention/sas2002/be/bel.prod0110.se8030ac.m525.dat 2>&1"
NOTE: 0 records were read from the infile OSCMD. NOTE: DATA statement used (Total process time): real time 1.48 seconds cpu time 0.00 seconds
37 38 %let work=%sysfunc(pathname(work)); 39 %put &=work; WORK=/saswork2/ua_bicoe/SAS_work715900039C52_stha8p08j/SAS_work0FAD00039C52_stha8p08j 40 filename oscmd pipe "uncompress -c &path./bel.prod0110.se8030ac.m525.dat.Z > &work./bel.prod0110.se8030ac.m525.dat 2>&1"; 41 42 data _null_; 43 infile oscmd; 44 input; 2 The SAS System 10:52 Thursday, September 26, 2024
45 put _infile_; 46 run;
NOTE: The infile OSCMD is: Pipe command="uncompress -c /dwh_actuariat/sasdata/Data_Retention/sas2002/be/bel.prod0110.se8030ac.m525.dat.Z > /saswork2/ua_bicoe/SAS_work715900039C52_stha8p08j/SAS_work0FAD00039C52_stha8p08j/bel.prod0110.se8030ac.m525.dat 2>&1"
NOTE: 0 records were read from the infile OSCMD. NOTE: DATA statement used (Total process time): real time 1.42 seconds cpu time 0.00 seconds
But I am unable to import a .dat file in sas
PROC IMPORT DATAFILE = "&work./bel.prod0110.se8030ac.m525.dat" OUT = np DBMS = DLM REPLACE; DELIMITER=" "; RUN;
... View more
Could anyone tell me why this sometimes happens if I do not explicitly include an else statement? I was expecting b321 to only equal 1 for nAtBat=321. Most of the time I have no problems with this, but once in awhile I spend half the day troubleshooting and am usually so fed up that I just add all the else statements and say good riddance. But I would like to understand why this happens. To be clear, nAtBat is the 2nd field. I appreciate any input! data bb;
retain b321 nAtBat;
set sashelp.baseball;
if nAtBat=321 then b321=1;
run;
... View more
I am using spanning header for the report. In that I am using underlined header by using across option. In this, I am not able to produce underline to the right side of the text of header. To add line to the left, I am adding spaces and that is producing the effect but even though I will use spaces after the text of spanning header, the underline is not going beyond the text itself. I am showing an example below.
I am using text something like " This is the text to be displayed at spanning header " (Note 10 blank spaces to each side of text while defining the variable) .
I am expecting results like
"__________This is the text to be displayed at spanning header__________".
But I am getting results like "__________This is the text to be displayed at spanning header". (Note no underline to the right side of the text).
The workaround I have found is to use a dot (.) to the right side of the text after spaces like this -
" This is the text to be displayed at spanning header ." (Note the dot before closing double quotes.)
This is doing what I expect (that is extension of underline to the right side of the text), but that is causing a problem too. It is showing dot after the underline which is not looking good. It is displaying text like "__________This is the text to be displayed at spanning header__________." (Note the dot before closing double quotes.)
I request to kindly let me know if there is any way to remove this dot (.) after the end of underline without loss of underline to the right side of the text.
Thanks in advance.
Thanking you,
Yours sincerely,
- Dr. Abhijeet Safai
... View more