12-23-2022
RandyStan
Fluorite | Level 6
Member since
03-09-2017
- 99 Posts
- 0 Likes Given
- 0 Solutions
- 1 Likes Received
-
Latest posts by RandyStan
Subject Views Posted 1304 12-23-2022 02:15 PM 1323 12-23-2022 02:01 PM 543 12-22-2022 10:41 AM 1317 12-19-2022 02:52 PM 408 10-10-2022 10:55 PM 1140 10-07-2022 02:10 PM 456 10-07-2022 12:29 PM 797 10-05-2022 01:37 PM 734 10-05-2022 12:21 PM 861 10-03-2022 11:36 PM -
Activity Feed for RandyStan
- Posted Re: Removing Duplicates by ID 1 on SAS Programming. 12-23-2022 02:15 PM
- Posted Removing Duplicates by ID 1 on SAS Programming. 12-23-2022 02:01 PM
- Posted Removing Duplicates by classes on SAS Programming. 12-22-2022 10:41 AM
- Posted Changing Format and Informat on SAS Programming. 12-19-2022 02:52 PM
- Posted Importing Files on SAS Programming. 10-10-2022 10:55 PM
- Posted Dropping a group while taking the mean on SAS Programming. 10-07-2022 02:10 PM
- Posted If then statement with conditions on SAS Programming. 10-07-2022 12:29 PM
- Posted First and last observations on SAS Programming. 10-05-2022 01:37 PM
- Posted Re: Forming time groups on SAS Programming. 10-05-2022 12:21 PM
- Posted Forming time groups on SAS Programming. 10-03-2022 11:36 PM
- Posted Re: Difference between days on SAS Programming. 07-11-2021 11:37 AM
- Posted Re: Difference between days on SAS Programming. 07-11-2021 10:05 AM
- Posted Difference between days on SAS Programming. 07-10-2021 11:47 AM
- Posted Extracting ID's on SAS Programming. 02-10-2021 10:06 AM
- Posted Re: Splitting a data set into many different files on SAS Programming. 02-09-2021 12:45 PM
- Posted Splitting a data set into many different files on SAS Programming. 02-09-2021 09:25 AM
- Posted Outputting variable value on SAS Programming. 11-03-2020 11:21 PM
- Got a Like for Previous observatio as last observation if missing. 10-25-2020 01:19 AM
- Posted Previous observatio as last observation if missing on SAS Programming. 10-25-2020 01:07 AM
- Posted Re: Filling in missing Values on SAS Programming. 10-19-2020 05:11 PM
-
My Liked Posts
Subject Likes Posted 1 10-25-2020 01:07 AM
08-10-2018
10:30 PM
Dear All My data is as follows ID ID_A Date 1. A 03JAN2010 1. A. 04JAN2010 1. A. 10JAN2010 1. B. 05JAN2010 1. B. 07JAN2010 2. A. 02FEB2010 2. A. 08FEB2210 2. C. 18JAN2010 2 C. 20JAN2010 I want to construct a variable that calculates the Days between the dates ID ID_A Date DBD_WO_Holidays. 1. A 03JAN2010 1 1. A. 04JAN2010 6 1. A. 10JAN2010. -50000 1. B. 05JAN2010. 2 1. B. 07JAN2010 -50000 2. A. 02FEB2010 6 2. A. 08FEB2210 -50000 2. C. 18JAN2010 2 2 C. 20JAN2010 -50000 The -50000 is just an indicator it is the last date for ID_A Thanks in advance Randy
... View more
07-09-2018
09:14 AM
Here is the data set and what i need. Thanks date tcode tm TID Want TID GET_TID 3-Jan-15 22 663 1 1 1 4-Jan-15 00002J66 663 2 2 1 3-Jan-15 00011BS 663 2 3 1 4-Jan-15 00011DEVD 663 2 4 1 3-Jan-15 00011KANN 663 2 5 1 3-Jan-15 00011KRS 663 2 6 1 4-Jan-15 00011NLSH 663 2 7 1 4-Jan-15 00011PAD 663 2 8 1 3-Jan-15 00011USDE 663 2 9 1 3-Jan-15 00069Z001 663 2 10 1 4-Jan-15 10039 1049 2 11 1 3-Jan-15 10163 1049 2 11 3-Jan-15 10273 1049 2 11 3-Jan-15 10273 1049 6 11 3-Jan-15 10273 1049 7 11 3-Jan-15 10273 1049 8 11 3-Jan-15 10273 1049 9 11 4-Jan-15 10273 1049 10 11 4-Jan-15 10273 1049 11 11 4-Jan-15 10273 1049 12 11 4-Jan-15 10273 1049 13 11 4-Jan-15 10273 1049 14 11 4-Jan-15 10273 1049 15 11 3-Jan-15 10489 1049 2 12 1 3-Jan-15 10629 1049 2 13 1
... View more
07-09-2018
12:38 AM
My Data set is as follows Date ST IDA IDA 01JAN2018 500 A AA 01JAN2018 501 A AA 02JAN2018 501 A AA 01JAN2018 499 A AB 02JAN2018 506 A AB 03JAN2018 590 A AB I need to group by IDA and IDB and add a variable Group Date ST IDA IDAB Group 01JAN2018 500 A AA 1 01JAN2018 501 A AA 1 02JAN2018 501 A AA 1 01JAN2018 499 A AB 2 02JAN2018 506 A AB 2 03JAN2018 590 A AB 2 I wrote this code proc sort data = have ; by date IDA IDB ; run; Data want; set have ; by date IDA IDB ; if first.IDA then do; Group = IDA +1; run; Am I making a mistake? Randy
... View more
06-30-2018
07:30 PM
Please check the CAT column. In the first data set the variables are missing. In the second, the data set I want, they column CAT is populated. Thanks so much
... View more
06-30-2018
07:14 PM
No difference. I saw that the formatting was messed up, so I posted it again. OI hope that the data and the question is clearer now.
... View more
06-30-2018
06:22 PM
Putting this question again because the formatting seems to be messed up Dear All:
My data set is as follows
Date ST IDa IDb Cat
JUN012018 500 A AA I
JUN022018 500 A AA I
JUN032018 500 A AA I
JUN012018 501 A AA
JUN022018 501 A AA
JUN032018 501 A AA
JUN012018 502 A AA I
JUN012018 502 A AA I
JUN012018 500 A AAB
JUN022018 500 A AAB
JUN032018 500 A AAB
JUN012018 501 A AAB D
JUN022018 501 A AAB D
JUN032018 501 A AAB D
JUN012018 502 A AAB
JUN012018 502 A AAB
and so on
The data set should look like this
Date ST IDa IDb Cat
JUN012018 500 A AA I
JUN022018 500 A AA I
JUN032018 500 A AA I
JUN012018 501 A AA I
JUN022018 501 A AA I
JUN032018 501 A AA I
JUN012018 502 A AA I
JUN012018 502 A AA I
JUN012018 500 A AAB D
JUN022018 500 A AAB D
JUN032018 500 A AAB D
JUN012018 501 A AAB D
JUN022018 501 A AAB D
JUN032018 501 A AAB D
JUN012018 502 A AAB D
JUN012018 502 A AAB D
Thanks
Stan
... View more
06-30-2018
06:16 PM
Dear All My data is as follows Date ST IDa IDb Cat JUN012018 500 A AA I JUN022018 500 A AA I JUN032018 500 A AA I JUN012018 501 A AA JUN022018 501 A AA JUN032018 501 A AA JUN012018 502 A AA I JUN012018 502 A AA I JUN012018 500 A AAB JUN022018 500 A AAB JUN032018 500 A AAB JUN012018 501 A AAB D JUN022018 501 A AAB D JUN032018 501 A AAB D JUN012018 502 A AAB JUN012018 502 A AAB and so on The data set should look like this Date ST IDa IDb Cat JUN012018 500 A AA I JUN022018 500 A AA I JUN032018 500 A AA I JUN012018 501 A AA I JUN022018 501 A AA I JUN032018 501 A AA I JUN012018 502 A AA I JUN012018 502 A AA I JUN012018 500 A AAB D JUN022018 500 A AAB D JUN032018 500 A AAB D JUN012018 501 A AAB D JUN022018 501 A AAB D JUN032018 501 A AAB D JUN012018 502 A AAB D JUN012018 502 A AAB D Thanks Stan
... View more
02-01-2018
11:12 PM
If that order comes in at 9:29:59 it transacts against the order 20000199 that comes in at 9:30:00 so the transaction time is 9:30:00 for TNUM 10001 not 9:29:59. Moreover, since 20000196 cannot fill the entire order 20000199 it is also filled by ORNUM 2000197 So the trade book should look like: ID Type BorS ORNUM Time BUYORNUM SELLORNUM TNUM A O B 20000196 9:29:59 A O B 20000197 9:30:00 A O S 20000199 9:30:00 A T 9:30:00 20000196 20000199 10001 A T 9:30:00 20000197 20000199 10002 and not A O B 20000196 9:29:59 A T B 9:29:59 20000196 20000199 10001 Once again my gratitude for all your help.
... View more
02-01-2018
10:35 PM
Hi ChrisNZ: I get what your saying. But what I posted is the sequential order of a trade book; and the sequencing is important. For example if ORNUM 20000196 came in at 9:29:59 and is filled by BUYORNUM 20000199 the sequencing may be broken by your solution. Thank you so much. I hope you can tweak the code to get the sequencing. Randy
... View more
02-01-2018
10:10 PM
Thanks so much. But this does not work. If you notice for ID = A at 9:30:00 SELLORNUM 20000199 is paired with two BUYORNUM 20000196 and 200197. So this is not the desired output. @ChrisNZ wrote: Like this? data O;
input (ID Type BorS ORNUM Time )(:$);
cards;
A O B 20000196 9:30:00
A O B 20000197 9:30:00
A O S 20000199 9:30:00
A O B 20000201 9:30:00
A O B 20000205 9:30:01
A O S 20000209 9:30:01
B O B 20000531 9:30:00
B O S 20000643 9:30:00
B O B 20000754 9:30:01
run;
data T;
input (ID Type BUYORNUM SELLORNUM TNUM Time )(:$);
cards;
A T 20000196 20000199 10001 9:30:00
A T 20000197 20000199 10002 9:30:00
A T 20000205 20000209 10004 9:30:01
B T 20000754 20000643 10010 9:30:01
run;
data WANT;
set O;
if _N_=1 then do;
dcl hash BUY(dataset:'T');
BUY.definekey('BUYORNUM');
BUY.definedata(all:'Y');
BUY.definedone();
dcl hash SELL(dataset:'T');
SELL.definekey('SELLORNUM');
SELL.definedata(all:'Y');
SELL.definedone();
if 0 then set T;
end;
call missing( BUYORNUM, SELLORNUM, TNUM );
output;
RC=BUY.find(key:ORNUM);
if RC=0 then do;
output;
RC=BUY.remove();
RC=SELL.remove(key:SELLORNUM);
end;
else do;
RC=SELL.find(key:ORNUM);
if RC=0 then do;
output;
RC=SELL.remove();
RC=BUY.remove(key:BUYORNUM);
end;
end;
drop RC;
run; ID Type BorS ORNUM Time BUYORNUM SELLORNUM TNUM A O B 20000196 9:30:00 A T B 20000196 9:30:00 20000196 20000199 10001 A O B 20000197 9:30:00 A T B 20000197 9:30:00 20000197 20000199 10002 A O S 20000199 9:30:00 A O B 20000201 9:30:00 A O B 20000205 9:30:01 A T B 20000205 9:30:01 20000205 20000209 10004 A O S 20000209 9:30:01 B O B 20000531 9:30:00 B O S 20000643 9:30:00 B T S 20000643 9:30:01 20000754 20000643 10010 B O B 20000754 9:30:01 B T B 20000754 9:30:01 20000754 20000643 10010
... View more
02-01-2018
08:16 PM
I have two Files: A and B. I want to merge/combine them in a particular way. They are in SAS format File A ID Type BorS ORNUM Time A O B 20000196 9:30:00 A O B 20000197 9:30:00 A O S 20000199 9:30:00 A O B 20000201 9:30:00 A O B 20000205 9:30:01 A O S 20000209 9:30:01 B O B 20000531 9:30:00 B O S 20000643 9:30:00 B O B 20000754 9:30:01 File B is as Follows ID Type BUYORNUM SELLORNUM TNUM Time A T 20000196 20000199 10001 9:30:00 A T 20000197 20000199 10002 9:30:00 A T 20000205 20000209 10004 9:30:01 B T 20000754 20000643 10010 9:30:01 The merged file should look like this. The logic is that if the ORNUM matches either the BUYORNUM or the SELLORNUM then type ‘T’ is inserted into the combined file ID Type BorS ORNUM Time BUYORNUM SELLORNUM TNUM A O B 20000196 9:30:00 A O B 20000197 9:30:00 A O S 20000199 9:30:00 A T 9:30:00 20000196 20000199 10001 A T 9:30:00 20000197 20000199 10002 A O B 20000201 9:30:00 A O B 20000205 9:30:01 A O S 20000209 9:30:01 A T 9:30:01 20000205 20000209 10004 B O B 20000531 9:30:00 B O S 20000643 9:30:00 B O B 20000754 9:30:01 B T 9:30:01 20000754 20000643 10010 Thanks in Advance
... View more
08-09-2017
12:31 AM
data group3 ; set names; format Gr3 1. gr3 = 1 ; run; data group3 ; set group3; if _N_ gt 3 then delete; run; data group5 ; set names; format Gr5 1. gr5 = 1 ; run; data group5 ; set group5; if _N_ gt 5 then delete; run; data want; merge names group3 group5; by name; run;
... View more
08-08-2017
04:01 PM
Dear All: My data is as follows: Name A AA AAA AB ABB ABC ACC And so forth I want to contruct Variables such that the data set now looks like Name Var3 Var5 A 1 1 AA 1 1 AAA 1 1 AB 1 ABB 1 ABC ACC It is possible to construct this data set with multiple steps. But is there a shorter way. Thanks Randy
... View more
- « Previous
- Next »