3 weeks ago
lichee
Quartz | Level 8
Member since
07-26-2022
- 82 Posts
- 38 Likes Given
- 1 Solutions
- 3 Likes Received
-
Latest posts by lichee
Subject Views Posted 440 04-03-2025 02:40 PM 510 04-02-2025 10:50 PM 553 04-02-2025 02:22 PM 623 12-06-2024 08:36 AM 617 12-05-2024 07:39 PM 679 12-05-2024 03:34 PM 1641 09-24-2024 12:22 AM 1654 09-24-2024 12:11 AM 1774 09-22-2024 09:51 PM 1912 09-20-2024 12:36 PM -
Activity Feed for lichee
- Posted Re: PROC HTTP to allow parameters on SAS Procedures. 04-03-2025 02:40 PM
- Liked Re: PROC HTTP to allow parameters for BrunoMueller. 04-03-2025 02:32 PM
- Posted Re: PROC HTTP to allow parameters on SAS Procedures. 04-02-2025 10:50 PM
- Liked Re: PROC HTTP to allow parameters for data_null__. 04-02-2025 10:22 PM
- Posted PROC HTTP to allow parameters on SAS Procedures. 04-02-2025 02:22 PM
- Liked Re: Use multiple odds ratios in PROC POWER LOGISTIC and output data for ballardw. 12-06-2024 10:08 AM
- Liked Re: How to numerate values into a list of macro variables for PeterClemmensen. 12-06-2024 09:22 AM
- Posted How to numerate values into a list of macro variables on SAS Programming. 12-06-2024 08:36 AM
- Posted Re: Use multiple odds ratios in PROC POWER LOGISTIC and output data on Statistical Procedures. 12-05-2024 07:39 PM
- Posted Use multiple odds ratios in PROC POWER LOGISTIC and output data on Statistical Procedures. 12-05-2024 03:34 PM
- Posted Re: How to program across rows to decide eligibility on SAS Programming. 09-24-2024 12:22 AM
- Posted Re: How to program across rows to decide eligibility on SAS Programming. 09-24-2024 12:11 AM
- Posted Re: How to program across rows to decide eligibility on SAS Programming. 09-22-2024 09:51 PM
- Liked Re: How to program across rows to decide eligibility for ballardw. 09-21-2024 12:02 AM
- Posted Re: How to program across rows to decide eligibility on SAS Programming. 09-20-2024 12:36 PM
- Posted Re: How to program across rows to decide eligibility on SAS Programming. 09-19-2024 10:50 AM
- Liked Re: How to program across rows to decide eligibility for DrAbhijeetSafai. 09-19-2024 10:43 AM
- Got a Like for How to program across rows to decide eligibility. 09-19-2024 07:56 AM
- Posted How to program across rows to decide eligibility on SAS Programming. 09-18-2024 04:07 PM
- Posted Re: Assign sequence id within group and order by date on SAS Programming. 09-18-2024 09:00 AM
-
Posts I Liked
Subject Likes Author Latest Post 2 1 2 1 1 -
My Liked Posts
Subject Likes Posted 1 09-18-2024 04:07 PM 2 06-12-2023 04:38 PM
04-03-2025
02:40 PM
Thanks a lot!
The first part works well. For the second part for a list of addresses, based on the log requesting entering "vintage" info, I modified the code your provided slightly as below, but still get "400 Bad Request".
proc http method="POST" url="https://geocoding.geo.census.gov/geocoder/geographies/address" in=multi form ( "addressFile" = addr filename="local.csv" header="Content-Type: application/octet-stream" , "benchmark" = "4", "vintage" = "4" nofilename header="Content-Type: text/plain" ) out=resp verbose ; debug level=0; run;
... View more
04-02-2025
10:50 PM
I believe it works with single quote, but I'm not sure how to interpret the log. The log was generated as in the screenshot below but no dataset or anything else. I thought it would write out geo info in certain form -- sorry that I'm accessing URL from SAS for the first time.
29 filename response temp;
30 proc http 31 url='https://geocoding.geo.census.gov/geocoder/geographies/address?street=1600+Pennsylvania+Ave+NW&city=Washington&sta 31 ! te=DC&zip=20500&benchmark=Public_AR_Current&vintage=Current_Current&format=json' 32 method="GET" 33 out=response; 34 run;
NOTE: 200 OK NOTE: PROCEDURE HTTP used (Total process time): real time 0.30 seconds cpu time 0.01 seconds
35 libname resp json fileref=response; NOTE: JSON data is only read once. To read the JSON again, reassign the JSON LIBNAME. NOTE: Libref RESP was successfully assigned as follows: Engine: JSON Physical Name: /saswork/SAS_workF4AE001C33F4_pd-sas-grd7.awscloud.cms.local/#LN00134
... View more
04-02-2025
02:22 PM
Hi all,
I'm trying to get geo info like census tract given a list of addresses through the site Census Geocoder, but cannot make PROC HTTP work so far.
Below is the code I have for the address of white house, 1600 Pennsylvania Ave NW,Washington, DC, 20500
filename response temp; proc http url="https://geocoding.geo.census.gov/geocoder/geographies/address?street=1600+Pennsylvania+Ave+NW&city=Washington&state=DC&zip=20500&benchmark=Public_AR_Current&vintage=Current_Current&format=json" method="GET" out=response; run; libname resp json fileref=response;
I got the warning messages as below:
WARNING: Apparent symbolic reference STATE not resolved. WARNING: Apparent symbolic reference STATE not resolved. WARNING: Apparent symbolic reference BENCHMARK not resolved. WARNING: Apparent symbolic reference VINTAGE not resolved. WARNING: Apparent symbolic reference FORMAT not resolved.
Additionally, I have about 100 addresses that I need to loop through. How can I set loop through using the address data set as below:
data address; infile datalines dlm=',' dsd; input id $ street $ city $ state $ zip $; datalines; 1,1600 Pennsylvania Ave NW,Washington,DC,20500 2,1234 Main street, City, DC, 12345 ; run;
Any suggestions are greatly appreciated!
L.
... View more
12-06-2024
08:36 AM
Hi all,
I have a list of values as below and want to assign macro variables (num_val&i.) like num_val1 for 0.5, num_val2 for 0.9, ... num_val5 for 2. Can anyone help me out? Thank you!
data have; infile datalines truncover dsd; input num_val; datalines; 0.5 0.9 1.1 1.5 2 ; run;
... View more
12-05-2024
07:39 PM
Thank you! This works. But When there are multiple covariates at the same time like below, the program takes large space. Do loop may process each set of combination of odds ratios with less space...
proc power; logistic vardist("treat") = ordinal((0 1):(0.2, 0.8)) vardist("time")=ordinal((1 2 3 4):(0.2 0.2 0.2 0.4)) vardist("Female") = BINOMIAL (0.54, 1) vardist("Age_4group") = ordinal((1 2 3 4):(0.251 0.265 0.215 0.269)) vardist("Race_Black") = BINOMIAL (0.105, 1) vardist("Race_Other") = BINOMIAL (0.23, 1) testpredictor = "treat" "time" testoddsratio = &or_value. covariates = "intervention_prd" |"time" | "Female" | "Age_4cat"|"Race_Black"|"Race_OthrNA" covoddsratios = &or_value.|&or_value.|&or_value.|&or_value.|&or_value.|&or_value. responseprob = 0.03 0.4 0.5 0.6 0.7 alpha = 0.05 power =0.8 ntotal = .; ods output fixedelements= work.fixed output=work.poweroutput ; run;
... View more
12-05-2024
03:34 PM
Hi All,
I wanted to use multiple odds ratios (&or_value. in the code below) for testoddratio and covoddsratios in the PROC POWER Logistic procedure. How can I set it up so that different combinations of all possible odds ratios are applied? For example, the list of odds ratios are 0.5, 0.9, 1.1, 1.5 and 2, covoddsratios will plug in all give possible values for each covariate. I'd also like to output the generated data files but cannot find appropriate output statement for PROC POWER. Below are the initial code I have:
data or_value; infile datalines truncover dsd; input ORs; datalines; 0.5 0.9 1.1 1.5 2 ; run;
proc sql noprint; select ORs into :or_value separated by ',' from or_value ;quit; %put or_value=&or_value.;
proc power; logistic vardist("treat") = ordinal((0 1):(0.2, 0.8)) vardist("time")=ordinal((1 2 3 4):(0.2 0.2 0.2 0.4)) testpredictor = "treat" "time" testoddsratio = &or_value. covariates = "intervention_prd" |"time" | "Female" covoddsratios = &or_value.| &or_value.| &or_value. |&or_value. responseprob = 0.03 0.4 0.5 0.6 0.7 alpha = 0.05 power =0.8 ntotal = .; run;
Thank you all!
... View more
09-24-2024
12:22 AM
WITHIN means after (which was why I kept using the term "follow-up"). For the record 111111,7/14/2018,7/19/2018 only the records with dates after 7/14/2018 affects it.
... View more
09-24-2024
12:11 AM
Sorry for all the confusion! Below is the updated HAVE (data I have) and WANT (target data I want). Essentially, I wanted to keep eligible records. But if a record with any ineligible record within 30 days for the same Person_ID, the record should be dropped.
data have;
infile datalines truncover dsd;
input Person_ID $ Begin_Date :mmddyy10. End_Date :mmddyy10. Eligible;
format Begin_Date End_Date mmddyy10.;
datalines;
111111,3/13/2018,3/15/2018,0
111111,4/24/2018,4/26/2018,0
111111,7/13/2018,7/14/2018,0
111111,7/14/2018,7/19/2018,1
111111,7/26/2018,7/30/2018,1
111111,11/17/2018,11/26/2018,1
222222,5/1/2018,5/4/2018,0
222222,5/17/2018,5/19/2018,1
333333,3/8/2018,3/9/2018,0
333333,4/17/2018,4/26/2018,0
333333,6/16/2018,6/20/2018,0
333333,7/3/2018,7/4/2018,0
333333,7/23/2018,7/24/2018,0
333333,8/9/2018,8/10/2018,0
333333,9/8/2018,9/11/2018,1
333333,9/11/2018,9/14/2018,1
333333,9/23/2018,9/26/2018,0
444444,7/5/2018,7/7/2018,0
444444,12/21/2018,12/28/2018,1
555555,4/28/2018,5/3/2018,1
555555,5/6/2018,5/10/2018,1
555555,11/26/2018,11/29/2018,1
666666,1/14/2018,1/24/2018,1
666666,1/29/2018,1/31/2018,1
666666,2/4/2018,2/5/2018,1
666666,2/7/2018,2/12/2018,1
666666,8/18/2018,8/23/2018,1
666666,8/24/2018,8/25/2018,1
666666,8/28/2018,9/3/2018,1
666666,9/6/2018,9/11/2018,1
666666,9/13/2018,9/16/2018,1
666666,9/22/2018,9/23/2018,0
666666,10/3/2018,10/16/2018,1
666666,11/4/2018,11/5/2018,1
666666,11/5/2018,11/12/2018,1
666666,12/25/2018,12/28/2018,1
666666,12/30/2018,12/31/2018,0
;
run;
data want; infile datalines truncover dsd; input Person_ID $ Begin_Date :mmddyy10. End_Date :mmddyy10.; format Begin_Date End_Date mmddyy10.; datalines; 111111,7/14/2018,7/19/2018 111111,7/26/2018,7/30/2018 111111,11/17/2018,11/26/2018 222222,5/17/2018,5/19/2018 444444,12/21/2018,12/28/2018 555555,4/28/2018,5/3/2018 555555,5/6/2018,5/10/2018 555555,11/26/2018,11/29/2018 666666,1/14/2018,1/24/2018 666666,1/29/2018,1/31/2018 666666,2/4/2018,2/5/2018 666666,2/7/2018,2/12/2018 666666,8/18/2018,8/23/2018 666666,10/3/2018,10/16/2018 666666,11/4/2018,11/5/2018 666666,11/5/2018,11/12/2018 ; run;
... View more
09-22-2024
09:51 PM
Thanks, Tom! My HAVE actually only includes Person_ID, Begin_Date, End_Date, and Eligible. Yes, Follow-up record is any observation in HAVE per Person_ID. However, only a follow-up record with dates within 30 days of the last record would affect the last record. If one record with Eligible=0, it would be excluded. If one record with Eligible=1, and its follow-up record has Begin_Date over 30 days after End_Date of the first record, the follow-up record does not affect the first record. However, if one record has Eligible=1, and its follow-up record has Begin_Date equal to or less than 30 days after End_Date of the first record, the follow-up record affects the first record: (1) if the follow-up record also has Eligible=1, both first and follow-up records are kept. (2) if the follow-up record has Eligible=0, both first and follow-up records are excluded. I hope this makes it a bit clearer. Thank you!
... View more
09-20-2024
12:36 PM
Thanks a lot! Your code helps me almost get there. One scenario somehow got dropped although I expect that to be kept. I just added Person_ID 66666 to HAVE data, where I expected the first four records (1/14/2018-2/12/2018) to be kept because there was no records within 30 days to have Eligible=0.
data have;
infile datalines truncover dsd;
input Person_ID $ Begin_Date :mmddyy10. End_Date :mmddyy10. Eligible Eligible_30_day Final_Eligible;
format Begin_Date End_Date mmddyy10.;
datalines;
111111,3/13/2018,3/15/2018,0,.,0
111111,4/24/2018,4/26/2018,0,0,0
111111,7/13/2018,7/14/2018,0,0,0
111111,7/14/2018,7/19/2018,1,1,1
111111,7/26/2018,7/30/2018,1,1,1
111111,11/17/2018,11/26/2018,1,0,1
222222,5/1/2018,5/4/2018,0,.,0
222222,5/17/2018,5/19/2018,1,1,1
333333,3/8/2018,3/9/2018,0,.,0
333333,4/17/2018,4/26/2018,0,0,0
333333,6/16/2018,6/20/2018,0,0,0
333333,7/3/2018,7/4/2018,0,1,0
333333,7/23/2018,7/24/2018,0,1,0
333333,8/9/2018,8/10/2018,0,1,0
333333,9/8/2018,9/11/2018,1,1,0
333333,9/11/2018,9/14/2018,1,1,0
333333,9/23/2018,9/26/2018,0,1,0
444444,7/5/2018,7/7/2018,0,.,0
444444,12/21/2018,12/28/2018,1,0,1
555555,4/28/2018,5/3/2018,1,.,1
555555,5/6/2018,5/10/2018,1,1,1
555555,11/26/2018,11/29/2018,1,0,1
666666,1/14/2018,1/24/2018,1,.,1
666666,1/29/2018,1/31/2018,1,1,1
666666,2/4/2018,2/5/2018,1,1,1
666666,2/7/2018,2/12/2018,1,1,1
666666,8/18/2018,8/23/2018,1,0,0
666666,8/24/2018,8/25/2018,1,1,0
666666,8/28/2018,9/3/2018,1,1,0
666666,9/6/2018,9/11/2018,1,1,0
666666,9/13/2018,9/16/2018,1,1,0
666666,9/22/2018,9/23/2018,0,1,0
666666,10/3/2018,10/16/2018,1,1,0
666666,11/4/2018,11/5/2018,1,1,0
666666,11/5/2018,11/12/2018,1,1,0
666666,12/25/2018,12/28/2018,1,0,0
666666,12/30/2018,12/31/2018,0,1,0
;
run;
... View more
09-19-2024
10:50 AM
Thanks, Dr. Safai! The thing is that eligibility is not simply person-based, but record-based. For example, Person_ID 333333 was eligible during 9/8/2018-9/11/2018 and 9/11/2018-9/14/2018, but within 30 days of most recently eligible record (9/11/2018-9/14/2018), the track record (9/23/2018-9/26/2018) showed 333333 was ineligible. This case all the records within the past 30 days (both 9/8/2018-9/11/2018 and 9/11/2018-9/14/2018) are considered ineligible.
... View more
09-18-2024
04:07 PM
1 Like
Hi everyone,
I'm trying to create a new eligibility file based on eligibility info (Eligible) and 30-day tracking eligibility info.
Track_30_day is to track if there was follow-up record that occurred within 30 days after last record's End_dt (it may not be needed): if date difference between lag of End_dt of first record and Begin_Dt of the following record) was less than or equal to 30, Track_30_day=1.
Final_Eligible was manually entered by myself based on the logic to create (it may not be needed either):
if a record was eligible (Eligible=1) without 30-day track record, it is eligible (Final_Eligible=1) ;
if a record was eligible (Eligible=1) with 30-day track record and the track record has Eligble=1, all associated records are eligible (Final_Eligible=1). Examples include the records for Person_ID 111111 with dates 7/14/2018-7/19/2018 and 7/26/2018-7/30/2018, the records for Person_ID 555555 with dates 4/28/2018-5/3/2018 and 5/6/2018-5/10/2018.
if a record was eligible (Eligible=1) with 30-day track record and the track record has Eligble=1, all associated records are ineligible (Final_Eligible=0); One example is the three records for Person 333333, 9/8/2018-9/11/2018, 9/11/2018-9/14/2018 and 9/23/2018-9/26/2018. Because the last record with dates 9/23/2018-9/26/2018 was not eligible and occurred within 30 days after the record before it, all associated records are considered ineligible.
Further, the "want" data set keeps only eligible records and concatenate the records with less than 30-day gap.
I hope this makes sense. Any programming insight on how to accomplish "want" data set is really appreciated.
data have;
infile datalines truncover dsd;
input Person_ID $ Begin_Date :mmddyy10. End_Date :mmddyy10. Eligible Eligible_30_day Final_Eligible;
format Begin_Date End_Date mmddyy10.;
datalines;
111111,3/13/2018,3/15/2018,0,.,0
111111,4/24/2018,4/26/2018,0,0,0
111111,7/13/2018,7/14/2018,0,0,0
111111,7/14/2018,7/19/2018,1,1,1
111111,7/26/2018,7/30/2018,1,1,1
111111,11/17/2018,11/26/2018,1,0,1
222222,5/1/2018,5/4/2018,0,.,0
222222,5/17/2018,5/19/2018,1,1,1
333333,3/8/2018,3/9/2018,0,.,0
333333,4/17/2018,4/26/2018,0,0,0
333333,6/16/2018,6/20/2018,0,0,0
333333,7/3/2018,7/4/2018,0,1,0
333333,7/23/2018,7/24/2018,0,1,0
333333,8/9/2018,8/10/2018,0,1,0
333333,9/8/2018,9/11/2018,1,1,0
333333,9/11/2018,9/14/2018,1,1,0
333333,9/23/2018,9/26/2018,0,1,0
444444,7/5/2018,7/7/2018,0,.,0
444444,12/21/2018,12/28/2018,1,0,1
555555,4/28/2018,5/3/2018,1,.,1
555555,5/6/2018,5/10/2018,1,1,1
555555,11/26/2018,11/29/2018,1,0,1
;
run;
data want;
infile datalines truncover dsd;
input Person_ID $ Begin_Date :mmddyy10. End_Date :mmddyy10.;
format Begin_Date End_Date mmddyy10.;
datalines;
111111,7/14/2018,7/30/2018
111111,11/17/2018,11/26/2018
222222,5/17/2018,5/19/2018
444444,12/21/2018,12/28/2018
555555,4/28/2018,5/10/2018
555555,11/26/2018,11/29/2018
;
run;
Thank you!
Lichee
... View more
09-18-2024
09:00 AM
Thanks, Patrick! It is likely that a previous agend_id shows up again for the same person. But for my current purpose, your code is sufficient.
... View more
09-18-2024
12:17 AM
Hi all,
I have a data file with each Person_ID having multiple records associated with Agent_IDs. The date information (Begin_Date and End_Date) is also available. I wanted to have the data sorted by Person_ID, dates and then Agent_ID and assign new ID (Agent_ID_Assigned in data file "want") for each Agent_ID by sorting order. Essentially Agent_ID_Assigned takes squence id ordered by date per Person_ID. The variable Agent_ID_Assigned is the target field to generate as shown in "want" data file below.
Any suggestion is greatly appreciated.
data have; infile datalines dlm="09"x dsd truncover; input person_id $ Begin_Date :mmddyy10. End_Date :mmddyy10. Agent_ID $ ; format Begin_Date End_Date yymmdd10. ; datalines; 11111 3/2/2018 3/13/2018 A1111 22222 1/11/2018 1/15/2018 A1234 22222 1/28/2018 2/2/2018 A1234 22222 2/8/2018 2/10/2018 A1200 22222 2/24/2018 2/26/2018 A1211 22222 8/17/2018 8/22/2018 A4111 33333 3/17/2018 3/23/2018 A2111 44444 3/13/2018 3/15/2018 A3111 44444 4/24/2018 4/26/2018 A3211 44444 7/13/2018 7/14/2018 A3211 44444 7/14/2018 7/19/2018 A1212 44444 7/26/2018 7/30/2018 A1212 44444 11/17/2018 11/19/2018 A1212 44444 11/19/2018 11/26/2018 A1212 ;
data want; infile datalines dlm="09"x dsd truncover; input person_id $ Begin_Date :mmddyy10. End_Date :mmddyy10. Agent_ID $ Agent_ID_Assigned ; format Begin_Date End_Date yymmdd10. ; datalines; 11111 3/2/2018 3/13/2018 A1111 1 22222 1/11/2018 1/15/2018 A1234 1 22222 1/28/2018 2/2/2018 A1234 1 22222 2/8/2018 2/10/2018 A1200 2 22222 2/24/2018 2/26/2018 A1211 3 22222 8/17/2018 8/22/2018 A4111 4 33333 3/17/2018 3/23/2018 A2111 1 44444 3/13/2018 3/15/2018 A3111 1 44444 4/24/2018 4/26/2018 A3211 2 44444 7/13/2018 7/14/2018 A3211 2 44444 7/14/2018 7/19/2018 A1212 3 44444 7/26/2018 7/30/2018 A1212 3 44444 11/17/2018 11/19/2018 A1212 3 44444 11/19/2018 11/26/2018 A1212 3 ;
... View more
09-16-2024
11:40 AM
Thanks, Ballard!
The interpretation is very helpful! Yes, I meant to use
responseprob = 0.4 0.5 0.6 0.7
Further questions I have are
1. Do the binary outcome variable and any binary covariates need to be set up as binomial(0.5, 1)?
2. I currently have vardist("time") = ordinal((0 1 3 4 5):(0 0.1 0.2 0.3 0.4)) even though there are six time points. I meant to skip the third time point (time =2). If I have all six time points and use vardist("time") = ordinal((0 1 2 3 4 5):(0 0.1 0 0.2 0.3 0.4)), does it mean the same thing as vardist("time") = ordinal((0 1 3 4 5):(0 0.1 0.2 0.3 0.4)) ? How would interpretation be different if I use vardist("time") = ordinal((0 1 3 4 5):(0 0.2 0.1 0.3 0.4)) ?
3. I believe that the current code setup only considers power of using Treatment and Time only. If I wanted to add additional covariates, I just need to include additional vardist. For example, to add the female indicator (gender effect) in the power analysis, I am thinking the code below. Am I correct?
proc power; logistic vardist("Success") = BINOMIAL (0.5, 1) vardist("Treatment") = binomial(0.5, 1)
vardist("Female")=binomial(0.5,1) vardist("time") = ordinal((0 1 3 4 5):(0 0.1 0.2 0.3 0.4)) testpredictor = "Success" covariates = "Treatment"|"time" "Female" responseprob = 0.4 0.5 0.6 .07 testoddsratio = 1.4 alpha = 0.05 power = 0.8 ntotal = .; run;
Thanks a lot!
... View more