3 weeks ago
NewUsrStat
Lapis Lazuli | Level 10
Member since
03-18-2017
- 264 Posts
- 105 Likes Given
- 0 Solutions
- 2 Likes Received
-
Latest posts by NewUsrStat
Subject Views Posted 875 3 weeks ago 928 3 weeks ago 625 3 weeks ago 674 4 weeks ago 690 4 weeks ago 577 03-11-2025 01:30 PM 1101 02-07-2025 06:14 AM 1165 02-07-2025 03:43 AM 1125 02-06-2025 12:28 PM 1227 02-06-2025 11:01 AM -
Activity Feed for NewUsrStat
- Liked Re: Remove duplicated records based on the comparison of two dates for Ksharp. 3 weeks ago
- Posted Re: Remove duplicated records based on the comparison of two dates on New SAS User. 3 weeks ago
- Posted Remove duplicated records based on the comparison of two dates on New SAS User. 3 weeks ago
- Got a Like for Assign events to weeks of year. 3 weeks ago
- Posted Re: Assign events to weeks of year on New SAS User. 3 weeks ago
- Posted Re: Assign events to weeks of year on New SAS User. 4 weeks ago
- Posted Assign events to weeks of year on New SAS User. 4 weeks ago
- Posted Join a table with another in long format by two variables on New SAS User. 03-11-2025 01:30 PM
- Liked Re: Transform a dataset from long to wide format and fill values for Patrick. 02-07-2025 01:01 PM
- Posted Re: Transform a dataset from long to wide format and fill values on New SAS User. 02-07-2025 06:14 AM
- Posted Transform a dataset from long to wide format and fill values on New SAS User. 02-07-2025 03:43 AM
- Liked Re: Add a value between two values of a variable for Tom. 02-06-2025 12:29 PM
- Posted Re: Add a value between two values of a variable on New SAS User. 02-06-2025 12:28 PM
- Posted Re: Add a value between two values of a variable on New SAS User. 02-06-2025 11:01 AM
- Posted Add a value between two values of a variable on New SAS User. 02-06-2025 10:48 AM
- Liked Re: Set a rule where never a value different from 0 or missing appears for FreelanceReinh. 02-06-2025 09:31 AM
- Posted Re: Set a rule where never a value different from 0 or missing appears on New SAS User. 02-06-2025 09:15 AM
- Posted Set a rule where never a value different from 0 or missing appears on New SAS User. 02-06-2025 08:52 AM
- Liked Re: Subtract exactly one year from a date for FreelanceReinh. 02-06-2025 08:39 AM
- Posted Subtract exactly one year from a date on New SAS User. 02-06-2025 04:42 AM
-
Posts I Liked
Subject Likes Author Latest Post 1 1 1 4 1 -
My Liked Posts
Subject Likes Posted 1 4 weeks ago 1 03-06-2024 11:23 AM
09-21-2022
06:19 AM
Hi,
suppose to have the following:
Subj Age
a 30-40
a 30-40
a 50-60
a 50-60
b 30-40
b 30-40
b 30-40
.................
Is there a way, for each Subj to replace for the age variable the values with the greatest ones? In other words, 30-40 for "a" should be replaced with 50-60. Thank you in advance.
... View more
09-11-2022
04:54 AM
Thank you very much!
... View more
09-10-2022
02:38 PM
Hi guys,
suppose to have the following:
data DB1;
input ID :$20. Start :$20. End :$20. Hospital :$20.;
cards;
0001 01JAN2015 06FEB2016 C
0001 07FEB2016 25APR2016 C
0001 26APR2016 31DEC2019 D
0002 01JAN2017 12JUL2017 C
0002 13JUL2017 31DEC2019 D
0002 01JAN2020 31DEC2020 D
;
data DB2;
input ID :$20. Start :$20. End :$20.;
cards;
0001 28JAN2016 08FEB2016
0001 24APR2016 28APR2016
0001 28NOV2019 13DEC2019
0002 11JUL2017 14JUL2017
0002 15JUL2017 01OCT2019
0002 14AUG2020 13SEP2020
;
expected:
data DB3;
input ID :$20. Start :$20. End :$20. Hospital :$20.;
cards;
0001 28JAN2016 08FEB2016 C
0001 24APR2016 25APR2016 C
0001 26APR2016 28APR2019 D
0001 28NOV2019 13DEC2019 D
0002 11JUL2017 12JUL2017 C
0002 13JUL2017 14JUL2017 D
0002 15JUL2017 01OCT2019 D
0002 14AUG2020 13SEP2020 D
;
In other words I would like to add the Hospital information to DB2 to obtain DB3 based on the range of its periods on DB1. When the period of DB2 is in between the hospital change of DB1 the period of DB2 would be splitted as shown in the output to take track of the hospital change. Can anyone help me please? thank you in advance.
... View more
09-06-2022
10:36 AM
Thank you dottor mkeintz. Your code works perfectly but counts are calculated also for vacations that is what is not desirable. In other words the counts must be 0 where the label is not "?" and the total, for each id must be scaled by the rows where the label is "?". I tried to put an if statement if(label ="?") then _count_per_day=counts/(1+End-Start) etc but it only sets 0 where the label is not "?" without scaling the counts on the days corresponding to "?".
... View more
09-06-2022
08:46 AM
1) Yes, each sub-period in have2 is contained in one of the intervals in have1. 2) Unfortunately the period 01JAN2015 - 31MAY2015 cannot be viewed as a single period because there are additional variables in the file which I have not shown for simplicity. 3) The ID does matter because of the presence of additional information in the original file.
I will edit the examples by adding another variable.
... View more
09-06-2022
08:17 AM
Hi guys,
suppose to have two data sets (files). File 1 is composed by time-periods with a label for each one and File2 that contains sub-periods without labels. I need to add labels to File2 based on the time interval from File1 so that if the period has Label "x" and the sub-period is contained in the period of File1, the sub-period will take the label from the period of File1.
Can anyone help me please?
data have1;
input ID :$20. Start :date9. End :date9. Label :$20. Role :$20.;
format start end yymmdd10.;
cards;
0001 01JAN2015 30APR2015 HospitalA ex005
0001 01MAY2015 31MAY2015 HospitalA ex004
0001 01JUN2015 31DEC2015 HospitalC ex005
0002 06FEB2018 08FEB2018 HospitalA ex004
0002 09FEB2018 31AUG2018 HospitalC ex005
0002 01SEP2018 31DEC2019 HospitalC ex004
0003 01JAN2019 30SEP2019 HospitalD ex008
0003 01OCT2019 31DEC2020 HospitalD ex004
;
File2:
data have2;
input ID :$20. Start :date9. End :date9.;
format start end yymmdd10.;
cards;
0001 01JAN2015 30JAN2015
0001 31JAN2015 15FEB2015
0001 15FEB2015 30APR2015
0001 01MAY2015 15MAY2015
0001 16MAY2015 31MAY2015
0001 01JUN2015 15SEP2015
0001 16SEP2015 31DEC2015
......
;
File3 desired output:
data output;
input ID :$20. Start :date9. End :date9. Label :$20. Role :$20.;
format start end yymmdd10.;
cards;
0001 01JAN2015 30JAN2015 HospitalA ex005
0001 31JAN2015 15FEB2015 HospitalA ex005
0001 15FEB2015 30APR2015 HospitalA ex005
0001 01MAY2015 15MAY2015 HospitalA ex004
0001 16MAY2015 31MAY2015 HospitalA ex004
0001 01JUN2015 15SEP2015 HospitalC ex005
0001 16SEP2015 31DEC2015 HospitalC ex005
......
;
... View more
08-23-2022
05:36 AM
Yes, basically I have to assign counts only to days out of vacations, i.e. working days. I think you addressed the point. Thank you for your help!
... View more
08-23-2022
01:31 AM
Sorry, I made errors while typing. I edited. ? means the split of for example 32.499 based on the time periods (days) 01JAN2015 02JAN2015 and 11JAN2015 18JAN2015 in want data set. 18JAN2015 is the end date 32.499 refers to in the work dataset. I only reported the output relative to 0001 for simplicity.
... View more
08-22-2022
05:04 PM
Hi guys, I have two data sets and, for each ID, I have to split each row of the first including the intervals of the second. Furthermore, while doing this, I need to divide the values in the Count variable of the first data set by the days in the new interval but only when the period refers to the first data set and not to the second because in this last case I will have a Label. Can anyone help me please? Here the data set and desired output: data work; input ID :$20. Start :date9. End :date9. Counts :$20.; format start end yymmdd10.; cards; 0001 01JAN2015 18JAN2015 32499 0001 19JAN2015 30APR2015 23458 0001 01MAY2015 13JAN2016 987 0002 06FEB2019 15FEB2019 3567 0002 16FEB2019 31DEC2019 1254 0003 01JAN2020 18MAR2020 652 0003 19MAR2020 02APR2020 765 0003 03APR2020 31DEC2020 200 data vacations; input ID :$20. Start :date9. End :date9. Label :$20.; format start end yymmdd10.; cards; 0001 03JAN2015 10JAN2015 A 0001 21JAN2015 21JAN2015 B 0001 03MAY2015 09JAN2016 C 0002 08FEB2019 08FEB2019 B 0002 09FEB2019 15FEB2019 A 0003 20FEB2020 25FEB2020 C 0003 21MAR2020 21MAR2020 B 0003 04JAN2020 10JAN2020 A ; data want; input ID :$20. Start :date9. End :date9. Label :$20. Counts_resized :$20.; format start end yymmdd10.; cards; 0001 01JAN2015 02JAN2015 ? 0001 03JAN2015 10JAN2015 A 0001 11JAN2015 18JAN2015 ? 0001 19JAN2015 20JAN2015 ? 0001 21JAN2015 21JAN2015 B 0001 22JAN2015 30APR2015 ? 0001 01MAY2015 02MAY2015 ? 0001 03MAY2015 09JAN2016 C 0001 10MAY2016 13JAN2016 ? …………. ; Thank you in advance
... View more
08-19-2022
05:26 AM
Sorry dott. Bremen. I was quite in trouble with timing.
... View more
08-19-2022
05:24 AM
Thank you dottor Clemmensen! Finally it works. I had only to manage some cases by removing them from the data.set, processing them separately and then I merged all and the result was what I was looking for. Thank you so much.
... View more
08-19-2022
02:34 AM
Hi guys, suppose to have the following: data have;
input ID :$20. Start :ddmmyy. End :ddmmyy. Label :$20.;
format start end yymmdd10.;
cards; 0001 01JAN1998 18JAN1998 A 0001 20JAN1998 22JAN1998 A
0001 02FEB1998 02FEB1998 A
0002 06FEB1998 08FEB1998 B
0002 03MAR2000 15MAR2000 A
0002 16MAR2000 18MAR2000 A 0003 01MAY2000 18MAY2000 C 0003 19MAY2000 22MAY2000 C ..... .................... ; I need the following: data want; set have; ID Start End Label Days 0001 01JAN1998 22JAN1998 A 22 0001 02FEB1998 02FEB1998 A 1
0002 06FEB1998 08FEB1998 B 2
0002 03MAR2000 18MAR2000 A 16 0003 01MAY2000 22MAY2000 C 22 .................................. ; Meaning, for each ID and for each condition summarise periods (update the end date and calculate the sum of the days) only if the periods differ of 1 day or they are consecutive like 18-20JAN and 15-16MAR, otherwise do nothing and only count the days in the interval. Can anyone help me please? I tried to remove the cases where I have not to sum and then merge with the records where I have to sum but SAS stops running. I have 68000 records totally. Thank you in advance
... View more
08-12-2022
04:45 AM
Hi guys, is there a way to remove rows in a file that are not present in a second file by matching the column ID? Thank you in advance For example suppose to have: data set1 ID AGE Role 001 35-50 A 002 55-60 B 003 35-50 C 004 35-50 D 005 35-50 E and data set2 ID Hours Vacancies 002 900 21 003 456 54 005 45 0 I would like the data set1 to become: ID AGE Role 002 55-60 B 003 35-50 C 005 35-50 E
... View more
08-11-2022
10:06 AM
So, I need to sort in ascending order the IDs and for each ID ascending order of dates
... View more
08-11-2022
09:46 AM
No, I would like to sort dates by in ascending but splitting by IDs, i.e., for each ID.
... View more
- « Previous
- Next »