f



Re: Help on data creation for SAS #6

Jack and Ya have pointed out your problem. In addition, I see some
redundancy within

If first.id then do ..... block.

After writing the record out you are resetting the values identical to the
conditions within the ELSE DO block.

If a second record is required to be written for the first.id then you need
another OUTPUT statement before the end. It is hard to guess what is needed
without further details. You have made a good effort by giving us a sample.
Can you also provide a sample output for the corresponding sample input? In
other words provide:

1. What you have (the input)
2. What you want out of it (the output)

Somebody will proide a response in due course.

Venky Chakravarthy


On Tue, 28 Nov 2006 15:23:29 -0500, Jack Clark <JClark@CHPDM.UMBC.EDU>
wrote:

>Kumar,
>
>The use of only 1 OUTPUT statement is at least part of the problem.  When
>you explicitly code an OUTPUT statement in the DATA step, you have to
>explicitly code it in each place you want to output.
>
>In the code that you sent, the OUTPUT statement only processes when
>FIRST.ID.  Try adding another OUTPUT statement at the end of the ELSE DO
>block.
>
>DATA A;
>SET B;
>BY ID;
>IF FIRST.ID THEN DO;
>        EVID = 1;
>        MDV = 1;
>        DV= 0;
>        CMT = 1;
>        AMT = DOSE;
>        OUTPUT;
>        AMT= .;
>        EVID = 0;
>        DV = CONC;
>        CMT = 2;
>END;
>ELSE DO;
>       AMT = .;
>       EVID = 0;
>       DV = CONC;
>       CMT = 2;
>       OUTPUT;
>END;
>RUN;
>
>
>Jack Clark
>Research Analyst
>Center for Health Program Development and Management
>University of Maryland, Baltimore County
>
>
>
>-----Original Message-----
>From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Kumar
>Sent: Tuesday, November 28, 2006 3:01 PM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Help on data creation for SAS
>
>Dear Sir,
>
>I have data set that i am preparing for use in NONMEM. I used an
>existing macro in SAS to create the data file, but i am able to read
>only the first row which is the data at time zero (a sample of the data
>set shown below) none of the other observations are recorded onto my
>output file... Can you please help me
>
>DATA A;
>
>SET B;
>
>BY ID;
>
>IF FIRST.ID THEN DO;
>
>        EVID = 1;
>        MDV = 1;
>        DV= 0;
>        CMT = 1;
>        AMT = DOSE;
>        OUTPUT;
>        AMT= .;
>       EVID = 0;
>        DV = CONC;
>        CMT = 2;
>       END;
>       ELSE DO;
>       AMT = .;
>       EVID = 0;
>       DV = CONC;
>       CMT = 2;
>       END;
>      RUN;
>
>Sample Data Set
>
>
>
>  ID    TIME    CONC    DOSE
>101     0       0       5000
>101     0.25    0       5000
>101     0.5     1.8     5000
>101     0.75    16.5    5000
>101     1       20.9    5000
>101     1.5     32.3    5000
>101     2       28.2    5000
>101     3       24.7    5000
>101     4       24.4    5000
>102           0               0            5000
>102             0.25        20           5000
>
>
>Regards
>Kumar
0
swovcc (579)
11/28/2006 8:38:18 PM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

0 Replies
319 Views

Similar Articles

[PageSpeed] 15

Reply:

Similar Artilces:

Re: How to filter sas data sets into separate sas data sets #6
First off, you don't need two set statements, I suspect you want a merge. (remember to sort datasets before merging) Data newlist (KEEP=node1 node2 node3 ... var15) Otherds (Keep=node1 node2 node3 .... var15) ; Merge sasds1 sasds2; By ;/*not sure which variable you need, but there has to be something that is the same between the two*/ What I'd really need to know is what are the field names in DS1 and DS2 (You described them but didn't tell us the names) You will possibly need a REANME= statement to get a matching name to merge by. Either read up more on merges and RENAME or get back to us with the variable names, and some sample data (maybe a proc print with obs=20). HTH -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Lizette Koehler Sent: Monday, April 02, 2007 9:53 AM To: SAS-L@LISTSERV.UGA.EDU Subject: How to filter sas data sets into separate sas data sets Listers, This is my failing point in coding SAS. The use of 2 separate SAS data sets to create a third. I can do this in a program with nested Do loops. But with SAS it is just different enough I seem to be unable to see the coding technique. Problem: Sas Data set 1 contains 1 variable and 1000 obs. Sas Data set 2 contains 15 variables and 500000 obs. I need to filter off the data in Sas data set 2 based on Sas data set 1 Node1, Node2 and Node3 must match VAR1 exactly. I have all the code I need to do this except for splitting the...

Re: Deleting SAS Data from a SAS DATASET #6
I have been watching this thread today and I just now recall an example that Paul Dorfman gave at a RUG several years ago and no, I don't recall exactly where or when other than it was NESUG or SESUG in the past 5 years. Anyway, Paul had a client who was storing something like the past 12 months of transactions as variables andat the start of each month needed to stick the just ended month on the end and drop the oldest month. Paul used Peek to read the last 11 months of each obs as a single chunk of data, append the current's month, and then used Poke to write the whole new obs as a unit. The time reduction was dramatic. It probably would not work here unless you knew a whole lot about the structure of the data set and it has a very fixed structure but I was so impressed with the solution that I like to mention it whenever it seems even remotely useful. Nat Wooding Environmental Specialist III Dominion, Environmental Biology 4111 Castlewood Rd Richmond, VA 23234 Phone:804-271-5313, Fax: 804-271-2977 CONFIDENTIALITY NOTICE: This electronic message contains information which may be legally confidential and/or privileged and does not in any case represent a firm ENERGY COMMODITY bid or offer relating thereto which binds the sender without an additional express written confirmation to that effect. The information is intended solely for the individual or entity named above and access by anyone else is unauthorized. If you are not the intended recipient, any disclos...

Re: Help on data creation for SAS
data A; set B; where time=0; run; On 11/28/06, Kumar <iyer.bharath@gmail.com> wrote: > > Dear Sir, > > I have data set that i am preparing for use in NONMEM. I used an > existing macro in SAS to create the data file, but i am able to read > only the first row which is the data at time zero (a sample of the data > set shown below) none of the other observations are recorded onto my > output file... Can you please help me > > DATA A; > > SET B; > > BY ID; > > IF FIRST.ID THEN DO; > > EVID = 1; > MDV = 1; > DV= 0; > CMT = 1; > AMT = DOSE; > OUTPUT; > AMT= .; > EVID = 0; > DV = CONC; > CMT = 2; > END; > ELSE DO; > AMT = .; > EVID = 0; > DV = CONC; > CMT = 2; > END; > RUN; > > Sample Data Set > > > > ID TIME CONC DOSE > 101 0 0 5000 > 101 0.25 0 5000 > 101 0.5 1.8 5000 > 101 0.75 16.5 5000 > 101 1 20.9 5000 > 101 1.5 32.3 5000 > 101 2 28.2 5000 > 101 3 24.7 5000 > 101 4 24.4 5000 > 102 0 0 5000 > 102 0.25 20 5000 > > > Regards > Kumar > ...

Re: Help on data creation for SAS #2
You need to remove the 'output' statement. Once the output is used in data step, the default implied output is broken. Since you did not ask SAS to output other records (except the first.id), they will not be output. Another way is to add a output statement after the if then. On Tue, 28 Nov 2006 12:01:14 -0800, Kumar <iyer.bharath@GMAIL.COM> wrote: >Dear Sir, > >I have data set that i am preparing for use in NONMEM. I used an >existing macro in SAS to create the data file, but i am able to read >only the first row which is the data at time zero (a sample of the data >set shown below) none of the other observations are recorded onto my >output file... Can you please help me > >DATA A; > >SET B; > >BY ID; > >IF FIRST.ID THEN DO; > > EVID = 1; > MDV = 1; > DV= 0; > CMT = 1; > AMT = DOSE; > OUTPUT; > AMT= .; > EVID = 0; > DV = CONC; > CMT = 2; > END; > ELSE DO; > AMT = .; > EVID = 0; > DV = CONC; > CMT = 2; > END; > RUN; > >Sample Data Set > > > > ID TIME CONC DOSE >101 0 0 5000 >101 0.25 0 5000 >101 0.5 1.8 5000 >101 0.75 16.5 5000 >101 1 20.9 5000 >101 1.5 32.3 5000 >101 2 28.2 5000 >101 3 24.7 50...

Re: Help on data creation for SAS #3
Kumar, The use of only 1 OUTPUT statement is at least part of the problem. When you explicitly code an OUTPUT statement in the DATA step, you have to explicitly code it in each place you want to output. In the code that you sent, the OUTPUT statement only processes when FIRST.ID. Try adding another OUTPUT statement at the end of the ELSE DO block. DATA A; SET B; BY ID; IF FIRST.ID THEN DO; EVID = 1; MDV = 1; DV= 0; CMT = 1; AMT = DOSE; OUTPUT; AMT= .; EVID = 0; DV = CONC; CMT = 2; END; ELSE DO; AMT = .; EVID = 0; DV = CONC; CMT = 2; OUTPUT; END; RUN; Jack Clark Research Analyst Center for Health Program Development and Management University of Maryland, Baltimore County -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Kumar Sent: Tuesday, November 28, 2006 3:01 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Help on data creation for SAS Dear Sir, I have data set that i am preparing for use in NONMEM. I used an existing macro in SAS to create the data file, but i am able to read only the first row which is the data at time zero (a sample of the data set shown below) none of the other observations are recorded onto my output file... Can you please help me DATA A; SET B; BY ID; IF FIRST.ID THEN DO; EVID = 1; MDV = 1; DV= 0; CMT = 1; AMT = DOSE; OUTPUT; AMT...

Re: Help on data creation for SAS #4
The reason why you get only one row for id 101 is becuase your by variable is id.If you want a unique combination of ID and time you will have to include both of them in the by statement. HTH Mona ----- Original Message ---- From: Kumar <iyer.bharath@GMAIL.COM> To: SAS-L@LISTSERV.UGA.EDU Sent: Tuesday, November 28, 2006 3:01:14 PM Subject: Help on data creation for SAS Dear Sir, I have data set that i am preparing for use in NONMEM. I used an existing macro in SAS to create the data file, but i am able to read only the first row which is the data at time zero (a sample of the data set shown below) none of the other observations are recorded onto my output file... Can you please help me DATA A; SET B; BY ID; IF FIRST.ID THEN DO; EVID = 1; MDV = 1; DV= 0; CMT = 1; AMT = DOSE; OUTPUT; AMT= .; EVID = 0; DV = CONC; CMT = 2; END; ELSE DO; AMT = .; EVID = 0; DV = CONC; CMT = 2; END; RUN; Sample Data Set ID TIME CONC DOSE 101 0 0 5000 101 0.25 0 5000 101 0.5 1.8 5000 101 0.75 16.5 5000 101 1 20.9 5000 101 1.5 32.3 5000 101 2 28.2 5000 101 3 24.7 5000 101 4 24.4 5000 102 0 0 5000 102 0.25 20 5000 Regards Kumar ...

Re: Help on data creation for SAS #5
Kumar , You have an explicit output statement in your first do loop block. When you explicitly code an output statement it overrides the implicit one inherent in the data steps do-loop. Thus, you only get the first observations which happen to correspond to time zero in yoru output data set. If you want more than just the first observation of your by group you will need to either get rid of that output statement and let the default data steps do-loop output statement take over or you will need to code more output statements where appropriate. Toby Dunn Quickly, bring me a beaker of wine, so that I may wet my mind and say something clever. Aristophanes Wise people, even though all laws were abolished, would still lead the same life. Aristophanes You should not decide until you have heard what both have to say. Aristophanes From: Kumar <iyer.bharath@GMAIL.COM> Reply-To: Kumar <iyer.bharath@GMAIL.COM> To: SAS-L@LISTSERV.UGA.EDU Subject: Help on data creation for SAS Date: Tue, 28 Nov 2006 12:01:14 -0800 Dear Sir, I have data set that i am preparing for use in NONMEM. I used an existing macro in SAS to create the data file, but i am able to read only the first row which is the data at time zero (a sample of the data set shown below) none of the other observations are recorded onto my output file... Can you please help me DATA A; SET B; BY ID; IF FIRST.ID THEN DO; EVID = 1; MDV = 1; DV= 0; CMT = 1; A...

Re: What r the data types in SAS? in Base SAS , and SAS SQL
> From: Amar Mundankar > Sent: Tuesday, July 21, 2009 8:10 AM > To: sas-l@uga.edu > Subject: What r the data types in SAS? in Base SAS , and SAS SQL > > Hi all, > What are the different data types in Base SAS and SAS SQL?? character, lengths from 1 to 32,000+ numeric: lengths from 2 to 8 dates are a subtype of numeric and are identified by their date, datetime, or time formats the new proc TSPL (Table Server Processing Language) supports ANSI data types: bigint, tinyint, etc. http://support.sas.com/documentation/cdl/en/tsag/30878/HTML/default/a003 065339.htm http://s...

Re: SAS help on data analysis #6 649037
Mike, This can be done with an extra data step or in one if you are reading raw data. How should we handle missing values? The LAG() function is indeed what you want, but you need but one call: data one ; do i = 1 to 100 ; output ; end ; run ; data two ( drop = sum lag4 ) ; set one ; sum + i ; lag4 = lag4( i ) ; if _n_ > 4 then do ; ave = sum / 5 ; sum +- lag4 ; end ; run ; Write back to the list with more details if you have not yet found the clue that would help you... Regards, Kevin Kevin Viel Department of Epidemiology Rollins School of P...

Re: SAS help on data analysis #6 1548036
Hi Mike: Are you looking for something like this: data tep; input x y; mean_x=Mean(x,lag1(x),lag2(x),lag3(x),lag4(x)); cards; 1 5 2 5 2 8 3 6 4 5 9 8 2 8 ; run; proc print;run; , If you can give us some sample data, Maybe we can help you better. Baogong On 6/16/05, Mike Smith <del101679@yahoo.com> wrote: > Hi. I wanted to compute the average of every five numbers in my data set in > SAS. How do I do it? Thanks. > -- Baoogng Jiang Department of Agronomy Lousisana State University ...

Re: help with reading ASCII data into SAS #6
I'm only reposting my suggestion, with changes (suggested by Andre offline), that are obviously needed for the code to work correctly. Specifically, I had moved the formats and informats to the end of the code (so as not to change the order in the PDF) but, as a result, made then ineffective. As such, my suggested code should have read: data a; informat dd dtc dtm anydtdtm19. ; format dd dtc dtm datetime21.; informat u $10.; format u $10.; infile "data.txt" dlm=',' dsd firstobs=2 lrecl=200; input site id pid it $ dd itd rtd linkid sp fc dtc dtm u $; run; Art -------- On Wed, 5 Nov 2008 20:38:24 -0500, Arthur Tabachneck <art297@NETSCAPE.NET> wrote: >Olive, > >Try: > >data a; > infile "data.txt" dlm=',' dsd firstobs=2 lrecl=200; > input site id pid it $ dd itd rtd linkid sp fc dtc dtm u $; > informat dd dtc dtm anydtdtm19. ; > format dd dtc dtm datetime21.; > informat u $10.; > format u $10.; >run; > >HTH, >Art >-------- >On Wed, 5 Nov 2008 11:36:20 -0800, olivesecret@GMAIL.COM wrote: > >>I tried Andre's code, that is, do not import data from the hard disc >>by infile statement, but copy all the data directly to sas using >>datalines. You know what? Now it works. So it means there is something >>wrong when I use infile statement to import data from the hard disc. >>Any suggestions? >>Thanks a lot! >> >> &g...

Re: SAS Advanced Programming Exam for SAS 9: SAS Joke of the year. #6
I interviewed at a company that gave a test where I had a half hour to produce a very simple report using PROC REPORT. I was provided all the manuals I wanted, but because I had used PROC REPORT before, I wanted none of them. I finished in five minutes, and most people on SAS-L would be able to beat that time. Bob Abelson HGSI 240 314 4400 x1374 bob_abelson@hgsi.com "toby dunn" <tobydunn@HOTMAIL.COM> Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> 09/04/2007 05:15 PM Please respond to "toby dunn" <tobydunn@HOTMAIL.COM> To SAS-L@LISTSERV.UGA.EDU cc Subject Re: SAS Advanced Programming Exam for SAS 9: SAS Joke of the year. Ed , I still contend and stick with they should both be able to program and know how SAS works. I prefer the intervewing company give a test, were the person being interviewed is sat in front a laptop or desktop and told to write code to solve some problems. No online help no books just the persona nd the computer. This weeds out those who can code and those who cant, from those who can you then talk to them about the code they wrote and you can deduce those who understand how SAS works and thos who dont. The pool you are left with are the qualified candidates atleast from a SAS perspective and you can make your choice from there. Toby Dunn Comprimise is like telling a lie, it gets easier and easier. Each comprimise you make, that becomes your standard. Perfection doesnt exist, once...

Re: How to filter sas data sets into separate sas data sets
Lizette, a quick question first: what release of SAS are you using? Seems like an ideal task for a hash solution. Hashes however are only available with SAS version 9. Robert Bardos Ansys AG, Zurich, Switzerland > -----Ursprüngliche Nachricht----- > Von: SAS(r) Discussion > [mailto:SAS-L@LISTSERV.UGA.EDU]Im Auftrag von > Lizette Koehler > Gesendet: Montag, 2. April 2007 16:53 > An: SAS-L@LISTSERV.UGA.EDU > Betreff: How to filter sas data sets into separate sas data sets > > > Listers, > > This is my failing point in coding SAS. The use of 2 > separate SAS data sets to create a third. > > I can do this in a program with nested Do loops. But > with SAS it is just different enough I seem to be > unable to see the coding technique. > > Problem: > > Sas Data set 1 contains 1 variable and 1000 obs. > Sas Data set 2 contains 15 variables and 500000 obs. > > I need to filter off the data in Sas data set 2 based > on Sas data set 1 > > Node1, Node2 and Node3 must match VAR1 exactly. I have > all the code I need to do this except for splitting the > data into a separate SAS data set (NEWLISTS). > > > Psuedo code: > > Sas Data set 1: Var1 Length 7 Char > Sas Data set 2: Node1 Length 1-8 Char Node2 Length > 1-8 Char Node3 Length 1-8 Char > > > > Data Newlist (KEEP=node1 node2 node3 ... var15) > Otherds (Keep=node1 node2 node3 .... var15) ; > ...

Re: How to filter sas data sets into separate sas data sets #5
Lizette: Can you show (1) your nested do loops that work for you, and (2) some sample data and the data sets that you desire to get? -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Lizette Koehler Sent: Monday, April 02, 2007 9:53 AM To: SAS-L@LISTSERV.UGA.EDU Subject: How to filter sas data sets into separate sas data sets Listers, This is my failing point in coding SAS. The use of 2 separate SAS data sets to create a third. I can do this in a program with nested Do loops. But with SAS it is just different enough I seem to be unable to see the coding technique. Problem: Sas Data set 1 contains 1 variable and 1000 obs. Sas Data set 2 contains 15 variables and 500000 obs. I need to filter off the data in Sas data set 2 based on Sas data set 1 Node1, Node2 and Node3 must match VAR1 exactly. I have all the code I need to do this except for splitting the data into a separate SAS data set (NEWLISTS). Psuedo code: Sas Data set 1: Var1 Length 7 Char Sas Data set 2: Node1 Length 1-8 Char Node2 Length 1-8 Char Node3 Length 1-8 Char Data Newlist (KEEP=node1 node2 node3 ... var15) Otherds (Keep=node1 node2 node3 .... var15) ; Set SASDS1 ; *Contains 1 var 1000 obs ; Set SASDS2 ; *Contains 15 vars and 500,000 obs ; If Node1 = VAR1 or Node2 = VAR1 or Node3 = Var1 then Output Newlist ; Else Output Otherds ; I have tried putting in two SET statements, but I seem to reduce the information dramatically. ...

Re: How to filter sas data sets into separate sas data sets #7
Summary: You need a loop and the POINT option or SQL #iw-value=1 Lizette, I think a lot of respondents have misunderstood the problem. This probably could have been avoided with a simplified example. Here is my interpretation. Here is code to generate data. data control ; do var1 = 1 to 4 ; output ; end ; run ; data tosplit ; input node1 node2 node3 other ; cards ; 1 2 3 4 1 2 3 5 7 7 7 7 ; Here is a way to split using the DATA step. data newlist other ; drop flag var1 ; set tosplit ; do pt = 1 to nobs ; set control point = pt nobs = nobs ; if var1 = node1 or var1 = node2 or var1 = node3 then flag = 1 ; end ; if flag then output newlist ; else output other ; run ; And here is a way to split using SQL. proc sql ; create table newlist as select * from tosplit where node1 in (select var1 from control) or node2 in (select var1 from control) or node2 in (select var1 from control) ; create table other as select * from tosplit where not(node1 in (select var1 from control) or node2 in (select var1 from control) or node2 in (select var1 from control)) ; quit ; Ian Whitlock ================ Date: Mon, 2 Apr 2007 10:53:08 -0400 Reply-To: starsoul@mindspring.com Sender: "SAS(r) Discussion" From: Lizette Koehler <starsoul@MINDSPRING.COM>...

Re: How to filter sas data sets into separate sas data sets #3
Lizette, Instead of trying to merge the two data sets, I would probably try to create a SAS format from the values of VAR1 in data set 1. Then, NODE1, NODE2 and NODE3 could be compared against the format for a match. The example below is a simplified version of what you could do and shows a printout of how it works. It has 5 observations in data set 1 and only 3 variables in data set 2, but I think the logic should hold for the example you gave. After the example is code that could be used to actually split the data as you had requested. Hope this helps. * create sas data set 1 ; data sasds1; input var1 $; cards; AAA BBB DDD FFF AAA HHH ; run; * sort data set 1 to eliminate any duplicate values ; proc sort nodupkey data = sasds1 out = sasds1_dd (rename=(var1=start)); by var1; run; * create data set that will be used to build SAS format ; data sasds1_dd; set sasds1_dd end=last; fmtname = '$NODES'; label = 'Y'; output; if last then do; hlo='O'; label='N'; output; end; run; * build format (the optional fmtlib option will print the format for you to review) ; proc format cntlin = sasds1_dd fmtlib; run; * create sas dataset 2 ; data sasds2; input node1 $ node2 $ node3 $; cards; ZZZ YYY XXX AAA YYY XXX ZZZ FFF XXX ZZZ YYY DDD AA YYY XXX ZZZ AAAA XXX ; run; * apply format to node1-node3 to determine if there is a match ; data testing; set sasds2; if put(node1,$nodes.) = 'Y' or put(node2,$nodes.) = '...

Re: How to filter sas data sets into separate sas data sets #2
you cannot do this as described without a common link here, your Var1 Note: both data sets must be sorted by Var1 Data Newlist (KEEP=node1 node2 node3 ... var15) Otherds (Keep=node1 node2 node3 .... var15) ; do until(EndoFile); Set SASDS1 SASDS2 end = EndoFile; by Var1; *consider: if Var1 in (Node1 Node2 Node3); If Node1 = VAR1 or Node2 = VAR1 or Node3 = Var1 then Output Newlist ; Else Output Otherds ; end; stop; Undoubtedly the HashHeads will propose a lookup table but the above is what you are trying to do. Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov > From: starsoul@mindspring.com > Listers, > > This is my failing point in coding SAS. The use of 2 > separate SAS data sets to create a third. > > I can do this in a program with nested Do loops. But with > SAS it is just different enough I seem to be unable to see > the coding technique. > > Problem: > > Sas Data set 1 contains 1 variable and 1000 obs. > Sas Data set 2 contains 15 variables and 500000 obs. > > I need to filter off the data in Sas data set 2 based on Sas > data set 1 > > Node1, Node2 and Node3 must match VAR1 exactly. I have all > the code I need to do this except for splitting the data into > a separate SAS data set (NEWLISTS). > > > Psuedo code: > > Sas Data set 1: Var1 Length 7 Char > Sas Data set 2: Node1 Length 1-8 Char Node2 Length 1-8 > Char Node3 Length 1...

Re: How to filter sas data sets into separate sas data sets #4
Something like this is the old way. You could use a proc sql if you have a new enough version. Increase your buffersize and if you have enough memory you may get it into a hash routine. DATA WORK.NEW; MERGE small (IN=A OBS=500) big ; BY ID_FIELD; IF A=1; RUN; QUIT; RICH -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@listserv.vt.edu] On Behalf Of Lizette Koehler Sent: Monday, April 02, 2007 10:53 AM To: SAS-L@LISTSERV.VT.EDU Subject: How to filter sas data sets into separate sas data sets Listers, This is my failing point in coding SAS. The use of 2 separate SAS data sets to create a third. I can do this in a program with nested Do loops. But with SAS it is just different enough I seem to be unable to see the coding technique. Problem: Sas Data set 1 contains 1 variable and 1000 obs. Sas Data set 2 contains 15 variables and 500000 obs. I need to filter off the data in Sas data set 2 based on Sas data set 1 Node1, Node2 and Node3 must match VAR1 exactly. I have all the code I need to do this except for splitting the data into a separate SAS data set (NEWLISTS). Psuedo code: Sas Data set 1: Var1 Length 7 Char Sas Data set 2: Node1 Length 1-8 Char Node2 Length 1-8 Char Node3 Length 1-8 Char Data Newlist (KEEP=node1 node2 node3 ... var15) Otherds (Keep=node1 node2 node3 .... var15) ; Set SASDS1 ; *Contains 1 var 1000 obs ; Set SASDS2 ; *Contains 15 vars and 500,000 obs ; If Node1 = VAR1 or No...

Re: How to filter sas data sets into separate sas data s ets
I think that both Ron's (as he mentioned) and Richard solutions require that VAR1 is in both datasets. But from the original post, it seemed to me that VAR1 is only in data set 1, and it must be matched to 1 of 3 variables in data set 2 (NODE1, NODE2 or NODE3) to be output to the NEWLIST data set. For this reason, I think a format is one possible approach. Maybe the original poster can clarify this point. Thanks. Jack Clark Research Analyst Center for Health Program Development and Management University of Maryland, Baltimore County -----Original Message----- From: SAS(r) Discussio...

Re: How to filter sas data sets into separate sas data sets #8
On Mon, 2 Apr 2007 23:37:16 +0000, Ian Whitlock <iw1junk@COMCAST.NET> wrote: >Summary: You need a loop and the POINT option or SQL >#iw-value=1 > >Lizette, > >I think a lot of respondents have misunderstood the problem. This probably >could have been avoided with a simplified example. Here is my >interpretation. Here is code to generate data. > > data control ; > do var1 = 1 to 4 ; output ; end ; > run ; > > data tosplit ; > input node1 node2 node3 other ; > cards ; > 1 2 3 4 > 1 2 3 5 > 7 7 7 7 > ; Here are test data generators which conform to the actual scale of the problem. data control; do _n_ = 1 to 1000; var1 = floor(ranuni(135)* 100000); output; end; run; data tosplit; do other = 1 to 500000; node1 = floor(ranuni(246)* 100000); node2 = floor(ranuni(246)* 100000); node3 = floor(ranuni(246)* 100000); output; end; run; > >Here is a way to split using the DATA step. > > data newlist other ; > drop flag var1 ; > set tosplit ; > do pt = 1 to nobs ; > set control point = pt nobs = nobs ; > if var1 = node1 or var1 = node2 or var1 = node3 then > flag = 1 ; > end ; > if flag then output newlist ; > else > output other ; > run ; At full scale the loop runs one half billion times. That took about 9 minutes on my PC....

Re: Converting surveymonkey data into sas data #6
Lorna , Well since others have brought it up I would be remiss if I didnt clarify: As I am not sure what the exact values you want to recode two possibilities come to miind: data one ; infile cards ; input VarA $ ; cards ; 0 1 2 3 4 5 6 ; run ; data two ; infile cards ; input VarA $6. ; cards ; 0 1 or 2 3-5 6 ; run ; proc format ; value $MonkA '0' = 1 '1' , '2' = 2 '3' , '4' , '5' = 3 other = XXX ; value $MonkB '0' = 1 '1 or 2' = 2 '3-5' = 3 other = XXX ; run ; data _null_ ; set one ; VarB = put(VarA , $MonkA.) ; put VarA= VarB= ; run ; data _null_ ; set two ; VarB = put(VarA , $MonkB.) ; put VarA= VarB= ; run ; Toby Dunn From: "Simon, Lorna" <Lorna.Simon@umassmed.edu> To: "toby dunn" <tobydunn@hotmail.com> Subject: RE: Converting surveymonkey data into sas data Date: Mon, 3 Apr 2006 12:47:02 -0400 Good ideas. I'll try them. thanks -----Original Message----- From: toby dunn [mailto:tobydunn@hotmail.com] Sent: Monday, April 03, 2006 12:36 PM To: Simon, Lorna; SAS-L@LISTSERV.UGA.EDU Subject: RE: Converting surveymonkey data into sas data Lorna , TRy using the strip function or left and trim functions to get rid of leading and trailing blanks. If it was me I would well do this any ways and I would skip the if statements and use a format. Your problem in V9 reduces to: proc format value $Monk...

Re: Clearing SAS Data Data from Prior Run #6
I'm glad you jumped in. The "collective" makes for better combined solutions. har har Here's one possible OT question: Is the interconnectivity of SAS-L like the "Borg"? Cheers. :o) Mark -----Original Message----- From: Nathaniel_Wooding@Dom.com [mailto:Nathaniel_Wooding@Dom.com] Sent: Friday, June 30, 2006 11:04 AM To: Terjeson, Mark (IM&R) Cc: SAS-L@LISTSERV.UGA.EDU Subject: Re: Clearing SAS Data Data from Prior Run Hi, Mark I knew that you knew but I didn't want some one to read the archives and be mislead. Have a great weekend. Isn't it a...

Re: Deleting SAS Data from a SAS DATASET
One thing you might do is to add an index on the snap_dt to the dataset; = if that's there then you should be able to delete the records in place: proc sql; delete from prod.master_date; where snap_dt =3D "&end_dt"d; quit; run; In both the ways you are trying now you are creating new data sets = rather than deleting records from the current data set; it would seem to = me that a SQL delete statement would be faster than creating new = datasets even if there isn't an index on the date.=20 -Mary ----- Original Message -----=20 From: SUBSCRIBE SAS-L Chandra Gadde=20 To: SAS-L@LISTSERV.UGA.EDU=20 Sent: Friday, August 15, 2008 12:14 PM Subject: Deleting SAS Data from a SAS DATASET Hi All I have several SAS datasets that are very very big. (50GB of size). = Every month, the data is being appended to these datasets. I need to deleted = the data which is greater than 24 months. What is the best method to do = this? Please help me. I tried PROC SQS and DATA STEP. But these two are taking very long = time. Data prod.Master_data; set prod.master_date; if snap_dt =3D "&end_dt"d then delete; run; proc sql; crete table prod.master_date from prod.master_date where snap_dt ne "&end_dt"d; quit; Hi You've got good ideas how to delete the old observations. My modify proposal was wrong. Sorry about that! I still think that changing the data model would be a good idea. Regards Patrick ...

Re: Compressing data sets (was Re: [SAS-L]) #2 #6
A new way to read/write Excel files in 9.1 was mentioned at SUGI, but as I recall it required a server running SAS/Access to PC File Formats. It wasn't SAS/Connect doing the reading and writing, just as SAS/Connect isn't doing the remote reading and writing in a regular Connect session. Or are you thinking of something else? -- JackHamilton@FirstHealth.com Manager, Technical Development Metrics Department, First Health West Sacramento, California USA >>> "Bruce Johnson" <bjohnson@SOLUCIENT.COM> 01/06/2004 10:02 AM >>> "using SAS/Connect to...

Web resources about - Re: Help on data creation for SAS #6 - comp.soft-sys.sas

Institute for Creation Research - Wikipedia, the free encyclopedia
The Institute for Creation Research (ICR) is a Christian apologetics institute in Dallas , Texas that specializes in education, research, and ...

Huge demand for Bakery on O’Connell creation cronut cone - AdelaideNow Search Search
... cone. ADELAIDE is going nuts over a new food sensation known as the cronut cone. North Adelaide’s Bakery on O’Connell is home to the creation ...

AMD Announces Radeon Pro Duo: Dual GPU Fiji Video Card For VR Content Creation
... name Radeon Pro Duo, the new card is a departure from the usual for AMD, with the company specifically targeting it towards VR content creation ...

Manage your audio creations with SoundCloud Pulse
... Skype Qik will head into the sunset late next month . Image credit: SoundCloud Blog SoundCloud Pulse: for creators Manage your audio creations ...

Creation of mini-organs follows mini-brains; teeny Frankensteins unlikely
Wee livers and heart tissue act like the real thing, may help test new meds.

"When judges are not interpreting, they’re creating, and to understand judicial creation one must understand ...
Writes Judge Richard A. Posner in a WaPo column titled "The Supreme Court is a political court. Republicans’ actions are proof." Priors are ...

What recession? Job creation jumps in February
Despite the strong headline number, the closely watched average hourly wages actually declined for the month.

Adobe rolls out new enterprise app creation service
Adobe has merged two of its app development services into one, in an attempt to help businesses easily build professional-looking apps, without ...

Check out the creation of the Steve Wozniak wax sculpture
Apple co-founder Steve Wozniak is well on his way to becoming a life-sized action figure. Not really, but we’re nerds, and that’s how we prefer ...

FilmBuff Acquires ‘Thank You For Playing’ Docu About Creation Of ‘That Dragon, Cancer’ Video Game
FilmBuff has licensed worldwide rights to distribute Thank You For Playing , the Tribeca Film Festival documentary from David Osit and Malika ...

Resources last updated: 3/18/2016 5:23:58 AM