01-04-2024
David_Billa
Rhodochrosite | Level 12
Member since
09-26-2019
- 667 Posts
- 482 Likes Given
- 1 Solutions
- 3 Likes Received
-
Latest posts by David_Billa
Subject Views Posted 813 01-04-2024 05:35 AM 840 01-04-2024 05:08 AM 1837 07-21-2023 07:29 AM 1861 07-21-2023 07:18 AM 1085 07-21-2023 06:36 AM 555 06-07-2023 02:56 PM 1045 06-01-2023 06:10 AM 4704 05-31-2023 03:38 PM 4725 05-31-2023 03:21 PM 4750 05-31-2023 03:11 PM -
Activity Feed for David_Billa
- Got a Like for In-database processsing Error. 11-22-2024 05:17 AM
- Posted Re: Query producing 0 row after having records in subquery on SAS Programming. 01-04-2024 05:35 AM
- Liked Re: Query producing 0 row after having records in subquery for yabwon. 01-04-2024 05:34 AM
- Posted Query producing 0 row after having records in subquery on SAS Programming. 01-04-2024 05:08 AM
- Liked Re: Aggregate in data step for ballardw. 07-24-2023 03:11 AM
- Liked Re: Aggregate in data step for Reeza. 07-24-2023 03:11 AM
- Posted Re: Aggregate in data step on SAS Programming. 07-21-2023 07:29 AM
- Posted Aggregate in data step on SAS Programming. 07-21-2023 07:18 AM
- Posted Macro parameter to repeat the value for n times on SAS Programming. 07-21-2023 06:36 AM
- Posted Proc Print on SAS Programming. 06-07-2023 02:56 PM
- Posted Re: Hex Format on SAS Programming. 06-01-2023 06:10 AM
- Liked Re: Special characters in IN operator for Reeza. 06-01-2023 01:27 AM
- Liked Re: Hex Format for Reeza. 06-01-2023 12:48 AM
- Liked Re: Hex Format for Tom. 06-01-2023 12:46 AM
- Liked Re: Hex Format for Reeza. 06-01-2023 12:45 AM
- Posted Re: Hex Format on SAS Programming. 05-31-2023 03:38 PM
- Posted Re: Hex Format on SAS Programming. 05-31-2023 03:21 PM
- Posted Re: Hex Format on SAS Programming. 05-31-2023 03:11 PM
- Posted Re: Hex Format on SAS Programming. 05-31-2023 03:02 PM
- Posted Re: Special characters in IN operator on SAS Programming. 05-31-2023 02:52 PM
-
Posts I Liked
Subject Likes Author Latest Post 1 1 1 1 1 -
My Liked Posts
Subject Likes Posted 1 01-08-2020 02:19 AM 1 07-27-2022 12:54 PM 1 04-10-2022 08:22 AM
01-04-2024
05:35 AM
@yabwon I agree with you. But still I want to know what would be likely cause for 0 rows in the outer query? Any issue with Where clause or last group by?
... View more
01-04-2024
05:08 AM
I'd like to understand the likely cause for 0 row after executing the aggregate query below. Subquery after first IN yields some rows but outer query is producing 0 rows. Ignore SAS syntax error please.
proc sql;
CREATE TEMP TABLE TEMP_RM_DUP_MEMBER_ADDL AS
SELECT (scan(merge_key,1,"-" )) as T_CLIENT_ID,
MAX(scan(merge_key,2,"-" )) as PT_MEDICARE_ID,
(scan(merge_key,3,"-" )) as SUB_GROUP_POLICY_NUM,
(scan(merge_key,4,"-" )) as PT_POLICY_START_DT,
(scan(merge_key,5,"-" )) as PT_POLICY_END_DTFROM FORM.MEMBER_addl
WHERE ((scan(merge_key,1,"-" )),
(scan(merge_key,2,"-" )),
(scan(merge_key,4,"-" )),
(scan(merge_key,5,"-" )))
IN
(
SELECT (scan(merge_key,1,"-" )) as PT_CLIENT_ID ,
MAX(scan(merge_key,3,"-" )) as SUB_GROUP_POLICY_NUM,
(scan(merge_key,4,"-" )) as PT_POLICY_START_DT,
(scan(merge_key,5,"-" )) as PT_POLICY_END_DT
FROM FORM.MEMBER_addl
WHERE ((scan(merge_key,1,"-" )),
(scan(merge_key,4,"-" )),
(scan(merge_key,5,"-" )))
IN
(
SELECT (scan(merge_key,1,"-" )) as PT_CLIENT_ID,
MAX(scan(merge_key,4,"-" )) as PT_POLICY_START_DT,
(scan(merge_key,5,"-" )) as PT_POLICY_END_DT
FROM FORM.MEMBER_addl
WHERE ((scan(merge_key,1,"-" )),
(scan(merge_key,5,"-" )) )
IN
(
SELECT (scan(merge_key,1,"-" )) as PT_CLIENT_ID,
MAX(scan(merge_key,5,"-" )) as PT_POLICY_END_DT
FROM (select * from FORM.MEMBER_addl
WHERE (scan(merge_key,1,"-" ))
IN
(
SELECT MEMBER_UMI_PIN
FROM raw.employee
WHERE optum_correlation_id = 199341349 AND MEMBER_UMI_PIN = 17654001001 ))
GROUP BY (scan(merge_key,1,"-" )))
GROUP BY (scan(merge_key,1,"-" )), (scan(merge_key,5,"-" )))
GROUP BY (scan(merge_key,1,"-" )), (scan(merge_key,4,"-" )), (scan(merge_key,5,"-" ))
)
GROUP BY (scan(merge_key,1,"-" )), (scan(merge_key,3,"-" )), (scan(merge_key,4,"-" )), (scan(merge_key,5,"-" )) ;
quit;
To summarize the issue, below query is producing 0 row in the result what would be the cause for the issue?
proc sql;
CREATE TEMP TABLE TEMP_RM_DUP_MEMBER_ADDL AS
SELECT (scan(merge_key,1,"-" )) as T_CLIENT_ID,
MAX(scan(merge_key,2,"-" )) as PT_MEDICARE_ID,
(scan(merge_key,3,"-" )) as SUB_GROUP_POLICY_NUM,
(scan(merge_key,4,"-" )) as PT_POLICY_START_DT,
(scan(merge_key,5,"-" )) as PT_POLICY_END_DTFROM FORM.MEMBER_addl
WHERE ((scan(merge_key,1,"-" )),
(scan(merge_key,2,"-" )),
(scan(merge_key,4,"-" )),
(scan(merge_key,5,"-" )))
IN
(
/*subqueries here producing results*/
)
GROUP BY (scan(merge_key,1,"-" )), (scan(merge_key,3,"-" )), (scan(merge_key,4,"-" )), (scan(merge_key,5,"-" )) ;
quit;
... View more
07-21-2023
07:29 AM
This is the interview question to my team member to test the knowledge in data step. I said aggregate as we want to use max and group by in SQL to achieve this.
... View more
07-21-2023
07:18 AM
I came across this question from someone which I'm not sure how to address it in data step. Question is I have a dataset which has variables like - Student_Name, Subject, Marks. Now I want to identify the
student name who scored high mark in each subject.
Excepted Result:
James Maths 95
David English 98
Kiran Social 97
... View more
07-21-2023
06:36 AM
Any leads on macro program to repeat the value for 'n' times? Assume I have the macro variables called 'name' and 'n'. If the value is 'David' and '100' then I want the name to print 100 times in the log.
Desired Output: 100 times value of name should be printed.
David
David
.....
David
... View more
06-07-2023
02:56 PM
There is a HTML and Javascript which reads data from SAS dataset and print the values in HTML webpage. I could see that only alphanumeric values are enclosed with double quotes and not the numbers although the datatype of the variable is character.
data test;
input batch $;
datalines;
123456
12AB45
1234AB
;
run;
proc print data=test;
run;
Excepted results to show in HTML page:
"123456","12AB45","1234AB"
This may not be the right forum to ask this question but still I want to know if there is something that can be done in SAS to tackle the issue.
... View more
06-01-2023
06:10 AM
@yabwon I want to delete CR, LF and Spaces or any special characters before and after the string. Then how to tweak your code?
... View more
05-31-2023
03:38 PM
I want to remove all the special/invisible characters including spaces before and after the string and NOT between the string.
... View more
05-31-2023
03:21 PM
Thank you for the instruction. Whether 0D0A in compress function removes special/invisible characters as well along with whitespaces before and after the strings?
... View more
05-31-2023
03:02 PM
I'm not certain how to remove white spaces and special characters before and after the strings. Any help?
... View more
05-31-2023
02:52 PM
@Tom I used your instruction to replace pipe with comma and it is producing one record in the result instead of two.
%let value2="Bank,ing"|"Insurance";
%let cslist=%sysfunc(translate(&value2,%str(,),|));
%put &=cslist;
data have;
input name $;
datalines;
Bank,ing
Insurance
;
run;
data want;
set have;
where name in ( %sysfunc(translate(&value2,%str(,),|)) );
run;
... View more
05-31-2023
02:43 PM
@mkeintz I tried this code and it yields only one record in the result instead of two.
%let value2="Bank,ing"|"Insurance";
%let cslist=%sysfunc(translate(&value2,%str(,),|));
%put &=cslist;
data have;
input name $;
datalines;
Bank,ing
Insurance
;
run;
data want;
set have;
where name in (%sysfunc(translate(&value2,%str(,),|)));
run;
Log:
84 data have;
85 input name $;
86 datalines;
NOTE: The data set WORK.HAVE has 2 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
89 ;
90 run;
91 data want;
92 set have;
93 where name in (%sysfunc(translate(&value2,%str(,),|)));
94 run;
NOTE: There were 1 observations read from the data set WORK.HAVE.
WHERE name='Bank,ing';
NOTE: The data set WORK.WANT has 1 observations and 1 variables.
... View more
05-31-2023
02:30 PM
@mkeintz @Tom I should not translate pipe to comma as there may be a value with comma between it (e.g. Firstname,Lastname) and it is valid.
... View more
05-31-2023
02:26 PM
I want to remove the special characters (spaces, CR, LF) before and after the string and NOT between the string. Currently following line is removing the spaces between the string which I don't want to do.
compress(string,'090A0C0D20A0'x))
E.g. If the string is 'Banking and Insurance' and I don't want to make it as 'BankingandInsurance' by removing the spaces between the string.
... View more