09-01-2015
vomer
Obsidian | Level 7
Member since
01-20-2012
- 117 Posts
- 0 Likes Given
- 0 Solutions
- 5 Likes Received
-
Latest posts by vomer
Subject Views Posted 4760 08-16-2013 09:40 AM 1674 08-01-2013 02:44 PM 4860 06-24-2013 12:33 PM 4760 06-20-2013 11:09 PM 12179 06-20-2013 11:00 PM 4860 06-20-2013 04:03 PM 12179 06-20-2013 02:27 PM 5058 06-20-2013 02:24 PM 32657 05-24-2013 12:49 PM 32657 05-24-2013 12:33 PM -
Activity Feed for vomer
- Got a Like for Stopping SAS program if an error occurs. 12-27-2023 07:14 AM
- Got a Like for Stopping SAS program if an error occurs. 12-27-2023 07:14 AM
- Got a Like for searching words in a variable. 11-04-2022 06:25 PM
- Got a Like for Re: Copying Files from one directory to another. 12-02-2020 06:49 PM
- Got a Like for Question on SQL to SAS. 06-25-2014 04:01 PM
- Posted Re: Identifying a sequence of events on SAS Procedures. 08-16-2013 09:40 AM
- Posted Transactions per client on SAS Procedures. 08-01-2013 02:44 PM
- Posted Re: Identifying a sequence of events on SAS Procedures. 06-24-2013 12:33 PM
- Posted Re: Identifying a sequence of events on SAS Procedures. 06-20-2013 11:09 PM
- Posted Re: proc import error on SAS Procedures. 06-20-2013 11:00 PM
- Posted Re: Identifying a sequence of events on SAS Procedures. 06-20-2013 04:03 PM
- Posted Re: proc import error on SAS Procedures. 06-20-2013 02:27 PM
- Posted Identifying a sequence of events on SAS Procedures. 06-20-2013 02:24 PM
- Posted Re: searching words in a variable on SAS Procedures. 05-24-2013 12:49 PM
- Posted Re: searching words in a variable on SAS Procedures. 05-24-2013 12:33 PM
- Posted searching words in a variable on SAS Procedures. 05-24-2013 12:25 PM
- Posted Re: Question on Date Macro on SAS Procedures. 05-08-2013 09:46 AM
- Posted Question on Date Macro on SAS Procedures. 05-07-2013 12:09 PM
- Posted Re: Creating new data set from 2 seperate datasets (SQL) on SAS Procedures. 03-20-2013 11:48 AM
- Posted Creating new data set from 2 seperate datasets (SQL) on SAS Procedures. 03-20-2013 10:19 AM
-
My Liked Posts
Subject Likes Posted 1 02-14-2012 10:34 AM 1 02-14-2012 11:03 AM 1 05-24-2013 12:25 PM 1 02-03-2012 01:48 PM 1 02-09-2012 10:33 AM
08-01-2013
02:44 PM
Hi there, I am wondering what the best way is to get this kind of analysis? Lets assume if my data looks like: ClientID | Transaction 001 | A1 001 | A1 001 | A2 001 | A3 002 | A4 002 | A5 003 | A6 003 | A6 Result would be: Client 001 has 3 unique transactions Client 002 has 2 unique transactions Client 003 has 1 unique transactions Thanks!
... View more
06-24-2013
12:33 PM
Hi there, I have a question around Haikou's code: data want; merge have have(firstobs=2 keep=event reason rename=(event=_e2 reason=_r2)) have(firstobs=3 keep=event reason rename=(event=_e3 reason=_r3)); RETAIN N; if event='S1' AND _E2='S5' AND _E3='S8' AND REASON='Reason 1' AND _R2 ='Reason 1' AND _R3 ='Reason 1' THEN N=3; IF N>0 THEN OUTPUT; N=N-1; drop n _:; RUN; I would like to know how I can add in an "ID" variable to consider in this code. For example - right now this code only considers the veriables "event" and "reason". What if I also have a customer ID variable that I would like to chunk this result by? For example: If I only want Ccustomer #1's data that follows that pattern? Obviously I would not know every customer's number in a large data set but rather would like the query about to "sort" by a customer ID variable.
... View more
06-20-2013
11:09 PM
Thanks everyone. There are some great suggestions here and I will take some time to explore them all. Haikou & PGStats - your updated solutions are new concepts for me - so many thanks for sharing these. I will have to read/experiment into these further. I will try to report back on my experience as I think it can help others like me in similar scenarios.
... View more
06-20-2013
11:00 PM
Try this: PROC IMPORT DATAFILE="c:\<path>\test.xls" OUT=seq(<for dataset options - see below> ) DBMS=excel REPLACE; GETNAMES=yes; * variable names are in row 1 ; RANGE="< range-name OR absolute-range"; * omit if you want to read the entire worksheet; Of course, you will need to save the file in xls instead of csv.
... View more
06-20-2013
04:03 PM
Hello Reeza, my dataset is quite large (close to a million rows of data). I am working with a smaller subset to see what solutions are possible in SAS as a testing ground. Thanks Reeza and Haikuo - I will attempt both these solutions and report back on my findings. Any other tips/solutions for large data are always welcome as I am still learning this scenario.
... View more
06-20-2013
02:27 PM
Try this: PROC IMPORT OUT=cla DATAFILE= "C:\shiva\not.csv" DBMS=CSV REPLACE; SHEET="sheet 1"; GETNAMES=YES; MIXED=YES; USEDATE=YES; SCANTIME=YES; RUN;
... View more
06-20-2013
02:24 PM
Hi all, I have a question on how the following can be achieved: Sample Data: Event Reason S1 Reason 1 S5 Reason 1 S8 Reason 1 S2 Reason 2 S1 Reason 4 S5 Reason 1 S8 Reason 5 S0 Reason 0 S3 Reason 7 S7 Reason 1 S1 Reason 1 S5 Reason 1 S8 Reason 1 Basically, I am trying to identify when a certain set of conditions are satisfied -> give me the count of this senario. So in the example above - I want to pull out the data where the sequence of "Event" goes from S1 to S5 to S8 and the Reason is Reason 1. Looking at the example above - I should get a total count of 2 and if I were to pull the data out into a new data set it would pull out the 2 sets where that sequence occurred and the reason was "Reason 1". Thanks for your help!
... View more
05-24-2013
12:49 PM
I looked up prx, but cannot get it to work. This sample I modified seems to be what I need, but it is not working:
data _null_;
if _N_ = 1 then
do;
retain patternID;
/* The i option specifies a case insensitive search. */
pattern = "/Mount|TGH|Joe|Michael|Sunny|Toro|Bay|Brid|Provi/i";
patternID = prxparse(pattern);
end;
input service_provider $90.;
call prxsubstr(patternID, service_provider, position);
if position ^= 0 then
do;
match = substr(service_provider, position);
put match:$QUOTE. "found in " service_provider:$QUOTE.;
end;
... View more
05-24-2013
12:33 PM
I tried scan and index - both give me this error: function call has too many arguments I have a bunch of keywords I am searching for in my code. Like this: got_value=SCAN(var_1,"key1","key2" etc.);
... View more
05-24-2013
12:25 PM
1 Like
Hi everyone, I am wondering how I can do the following: I have a data set with about 6000 rows of information - each field contains a string (something like this -> This is a sample text string) I was wondering what I can do to "search" all the rows of information for specific key words and then only keep those in my new smaller data set. Basically I want to say: if the words "this" "now" "then" appear in the column then keep that row or identify it somehow. Any sample codes would be greatly appreciated!
... View more
05-07-2013
12:09 PM
Hi there, I would like some help with the following macro: %let dt = %SYSFUNC(today(),MONYY.); This outputs the result: MAY13 How can this code be modified to show the previous month? i.e. APR13? Secondly, how can I make it look a bit different? Let's say like: April 2013 Thanks!
... View more
03-20-2013
11:48 AM
thanks! that works wonderfully well.
... View more
03-20-2013
10:19 AM
Hi all, Quick question: I have 2 datasets (ds1 and ds2) and they have some common variables (like ID, site name etc.) and some uncommon variables (flags and markers I have created in each) Is there any way using proc SQL to create a new dataset - that sources from ds1 and ds2 and computes sums from different variables? Example: DS1 DS2 Site Unit var Site Unit num A P1 0 A P1 1 B O1 1 B O1 1 B O1 1 B O1 1 C I1 0 C I1 0 C I1 0 C I1 1 Final DS Site Unit varsum numsum A P1 0 1 B O1 2 2 C I1 0 1
... View more