f



Re: How to read desired data from raw data set (with example)? #2

/**************************/
/** Create Data                     **/
/**************************/
data xx;
input Obs  ID TX $;
cards;
1    1   OUT
2    1   OUT
3    1   OUT
4    1   IN
5    1   OUT
6    1   OUT
7    1   IN
8    1   OUT
9    2   OUT
10   2   OUT
11   2   OUT
12   2   OUT
13   2   IN
14   2   IN
15   2   OUT
16   2   OUT
17   2   OUT
;
run ;


/*****************************/
/** Subset the data                    **/
/*****************************/

data one (drop = del _tx i) ;
set xx ;
by Id ;
retain del ;

if first.Id then del = 0 ;


/****************************/
/** If TX is 'IN' then look at next **/
/** record.  If TX is not equal to **/
/** 'IN' in the next record then  **/
/** mark the current record to   **/
/** keep.                                **/
/***************************/

if tx = 'IN' then do ;
pointer = _n_ + 1 ;
  do I = _n_ by 1 to (_n_) ;
   set xx (keep = TX rename = (tx = _tx)) point = pointer ;
    if _tx ne 'IN' then del = 1 ;
  end ;
end ;

if del ;
run ;

proc print
data = one ;
run ;




Toby Dunn




From: Ya Huang <ya.huang@AMYLIN.COM>
Reply-To: Ya Huang <ya.huang@AMYLIN.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: How to read desired data from raw data set (with example)?
Date: Thu, 30 Jun 2005 02:45:27 -0400


The following get what you need:

data xx;
input Obs  ID TX $;
cards;
1    1   OUT
2    1   OUT
3    1   OUT
4    1   IN
5    1   OUT
6    1   OUT
7    1   IN
8    1   OUT
9    2   OUT
10   2   OUT
11   2   OUT
12   2   OUT
13   2   IN
14   2   IN
15   2   OUT
16   2   OUT
17   2   OUT
;

data xx;
  set xx;
retain del;
by id tx notsorted;
if first.id and tx='OUT' then del=1;
else if first.id and tx='IN' then del=0;
if tx='IN' then del=0;
if tx='IN' and not last.tx then delete;
if del then delete;
drop del;
run;

proc print;
run;

Obs    Obs    ID    TX

  1       4     1    IN
  2       5     1    OUT
  3       6     1    OUT
  4       7     1    IN
  5       8     1    OUT
  6      14     2    IN
  7      15     2    OUT
  8      16     2    OUT
  9      17     2    OUT

Kind regards,

Ya Huang

On Wed, 29 Jun 2005 20:54:26 -0600, H.Ma <huaqiangm@GMAIL.COM> wrote:

 >Hi,
 >
 >I am struggling with one question of how to read desired data from the
 >raw data set? And here is the example data first:
 >
 >**Example:
 >
 >Obs  ID      TX
 >1    1       OUT
 >2    1       OUT
 >3    1       OUT
 >4    1       IN
 >5    1       OUT
 >6    1       OUT
 >7    1       IN
 >8    1       OUT
 >9    2       OUT
 >10   2       OUT
 >11   2       OUT
 >12   2       OUT
 >13   2       IN
 >14   2       IN
 >15   2       OUT
 >16   2       OUT
 >17   2       OUT
 >
 >**My question:
 >I want to read desired observations from the above raw data set:
 >  Within the SAME ID
 >  (1) whenever an observation with TX="IN", read all the observations
 >following it with TX=OUT until TX="IN" appears again.
 >  (2) If there is no observation with TX="OUT" following this
 >observation with TX="IN", then ignore it(the one with TX="IN", or in
 >the example, observation 13 will not be input).
 >
 >
 >**So I hope to get the data as follows:
 >Result:
 >Obs  ID      TX
 >4    1       IN
 >5    1       OUT
 >6    1       OUT
 >7    1       IN
 >8    1       OUT
 >14   2       IN
 >15   2       OUT
 >16   2       OUT
 >17   2       OUT
 >
 >Thank you for any helpful suggestions.
 >
 >
 >Richard
0
tobydunn (6020)
6/30/2005 3:18:48 PM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

0 Replies
448 Views

Similar Articles

[PageSpeed] 56

Reply:

Similar Artilces:

Re: How to read desired data from raw data set (with example)?
The following get what you need: data xx; input Obs ID TX $; cards; 1 1 OUT 2 1 OUT 3 1 OUT 4 1 IN 5 1 OUT 6 1 OUT 7 1 IN 8 1 OUT 9 2 OUT 10 2 OUT 11 2 OUT 12 2 OUT 13 2 IN 14 2 IN 15 2 OUT 16 2 OUT 17 2 OUT ; data xx; set xx; retain del; by id tx notsorted; if first.id and tx='OUT' then del=1; else if first.id and tx='IN' then del=0; if tx='IN' then del=0; if tx='IN' and not last.tx then delete; if del then delete; drop del; run; proc print; run; Obs Obs ID TX 1 4 1 IN 2 5 1 OUT 3 6 1 OUT 4 7 1 IN 5 8 1 OUT 6 14 2 IN 7 15 2 OUT 8 16 2 OUT 9 17 2 OUT Kind regards, Ya Huang On Wed, 29 Jun 2005 20:54:26 -0600, H.Ma <huaqiangm@GMAIL.COM> wrote: >Hi, > >I am struggling with one question of how to read desired data from the >raw data set? And here is the example data first: > >**Example: > >Obs ID TX >1 1 OUT >2 1 OUT >3 1 OUT >4 1 IN >5 1 OUT >6 1 OUT >7 1 IN >8 1 OUT >9 2 OUT >10 2 OUT >11 2 OUT >12 2 OUT >13 2 IN >14 2 IN >15 2 OUT >16 2 OUT >17 2 OUT > >**My question: >I want to read desired ob...

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
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: Reading SAS data sets on UNIX by non-SAS apps #2
John: Following on Richard's thoughtful suggestions, the Affinium system would likely capture data from csv files. SAS PROC EXPORT produces them quickly, and loading them into external systems works faster for relatively basic data structures and data formats, in my experience, than xml parsing. Sig -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of John Bentley Sent: Monday, October 18, 2004 10:10 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Reading SAS data sets on UNIX by non-SAS apps I have SAS data sets on AIX that we need to read with Unica's Affinium campaign management software, also on a UNIX box. (Let's not get into why we didn't go with the SAS Solution.) SAS Institute doesn't supply an ODBC driver for the UNIX environment, and the Affinium implementors don't want to use the SAS SQL Library for C and or deal with APIs. Other that dumping the SAS data sets as flat files, can anyone suggest a solution? Thanks in advance for the help. ...

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 #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 #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 #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: 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 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: XML data to SAS data set converstion #2
A correction. The initial post asked: "Is it possible to convert an XML data to SAS data set without a SAS environment?" If there is no SAS at all in a particular shop, then there is no way to do this conversion. If access to SAS is available via IOM then there are ways. What "environment" means becomes the question. If a shop can simply convert into a compatible SAS XML format that is a possibility. The other is to convert it into a delimited file or get it into a database that a SAS shop can read. The SAS dataset layout is binary and unknown. You could put it into a SAS transport file as well since that layout is known. I do not know of any tool, though, that can take XML and convert it into a transport file. Alan Alan Churchill Savian www.savian.net -----Original Message----- From: Alan Churchill [mailto:savian001@gmail.com] Sent: Sunday, March 09, 2008 5:38 AM To: 'tenny kurian'; 'SAS-L@LISTSERV.UGA.EDU' Subject: RE: XML data to SAS data set converstion It depends on the XML document. What is the complexity and what O/S are you running on? I have built utilities for doing XML to SAS conversion. You would need to use a .NET language and consume the dll. The tool can be found at: http://utilities.savian.net Look for Data Management Utilities. You could also try my XML to delimited and see if that works for you. I haven't touched it in a few years so let me know if does not work. For other tools, buy XmlSpy and do a conv...

Re: generating a data set and excluding from a data set? #2
A PROC SQL solution is... Data B ; Input val ; Cards4 ; 99 98 -10 ;;;; Data A ; Do i=1 to 10000 ; Drop i ; val = ceil( ranUni(1) * 120 ) - 20 ; Output ; End ; Run ; Proc sql ; Create table aMinusB as select * from A where ( val not in ( select val from B ) ) ; Quit ; Proc freq data=aMinusB ; Run ; Ed Edward Heaton, Senior Systems Analyst, Westat (An Employee-Owned Research Corporation), 1650 Research Boulevard, TB-286, Rockville, MD 20850-3195 Voice: (301) 610-4818 Fax: (301) 294-2085 mailto:EdHeaton@Westat.com http://www.Westat.com -----Original Message----- From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu] On Behalf Of selecao06 Sent: Thursday, November 29, 2007 2:06 PM To: sas-l@uga.edu Subject: generating a data set and excluding from a data set? Hi, I'd like to generate a data set from data set A, but exclude all values that are present from data set B. For example: data Temporary0; set A; if( val ~= 99 ) then output; run; only excludes the data with value 99. I'd like to exclude all values in this data set B: data B; input val; datalines; 99 98 -10 ; How do I do this efficiently? Thanks! ...

Re: Update info in data set based on other data set #2
Is this close to what you want? Sort A by id and date Sort B by id and date DATA C Read A observation WHILE B.id < A.id OR (B.id = A.id AND B.date <= A.date) Read B observation END varx = (A.date = B.date AND A.id = B.id) RUN -----Original Message----- From: Jan Sunde [mailto:snip] Sent: Tuesday, July 01, 2008 6:27 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Update info in data set based on other data set Hi I have a problem as follows : I want to create a dataset C that copies all of data set A as well as adds an additional variable (varx) as 0/1 based on whether an observation id in dataset A occurs in dataset B (on the same date). ...

Re: modifying a master data set with a transaction data set #2
Rune, Did you try this (just a guess)? data m; set t(rename=3D (b=3D newb)); modify m key=3D a; if _iorc_ ne 0 then _error_ =3D 0; else do; b =3D newb; output; end; run; Bora Y. ---------------------------------------------------------------------- Date: Tue, 31 Jan 2006 07:24:39 +0100 From: Rune Runnest=F8 <rune@FASTLANE.NO> Subject: Re: modifying a master data set with a transaction data set Yes, I know. But is there a way to make it work using the key =3D optio= n ? You see, I haven't constructed the code myself, it is pasted from an elearning course for = the advanced SAS sertification test. Should believe they knew what they present of code examples. Rune "Jiann-Shiun Huang" <Jiann-Shiun.Huang@AMERUS.COM> wrote in message news:s3de3cee.036@mail6.amerus.com... > Rune: > > Replacing the last data step by the following will work. > > data m; > modify m t; > by a; > run; > > > J S Huang > 1-515-557-3987 > fax 1-515-557-2422 > >>>> Rune Runnest=F8 <rune@FASTLANE.NO> 1/30/2006 3:52:19 PM >>> > Hi, > T is the transaction data set and M is the master data set. > The column a has an index on it on the master data set. When submitti= ng > the > last data set, > I get an error message: > ERROR: No matching observation was found in MASTER data set. >...

Re: Create different data set from one data set #2
adel_tangi@YAHOO.FR wrote: >I want to create different data sets from one data, by using one nominal >variable > >The values of the nominal variable have the following formats > > > >Var1 > >01XDAB > >01XDAC > >01XDAD > >01XEAB > >01XEAF > >01XEAH > >01XFGE > >01XFGF > >01XFGG > >01XFGH > >: > >: > > > >My aim is to create a data set when the first 4 digits of Var1 =01XD > >A second data set when the 4 digits of Var1 =01XE > >A third data set when the 4 digits of Var1 =01XF...

Re: How to output each obs. in a data set as a single data set? #2
liuberyl@GMAIL.COM wrote: >Hi All, > >I have a data set which contains hundreds of observations. Now I have >to output each observation as a single data, anyone know how to do >this in SAS? > >Thanks in advance! > >Pooh Obviously, Lord Voldemort is holdin you family captive. Because no one would want to do this of their own free will. I recommend contacting the Ministry of Magic at once. :-) Seriously, this is possible a very very bad idea. Why do you need to do this? Splitting logically-organized data up into hundreds of tiny pieces usually makes life harder for everyone. *Especially* you, when you have to use the data again. If you have no choice, then take a look at the SUGI papers of Paul Dorfman, who has written extensively about using hashes in the SAS 9 data step. He has shown ways to use a hash to split your data set into separate data sets. Since you want to do this line-by-line, you cna use a record counter as your 'by-group' and do this in a single step. HTH, David -- David L. Cassell mathematical statistician Design Pathways 3115 NW Norwood Pl. Corvallis OR 97330 _________________________________________________________________ Make every IM count. Download Messenger and join the i�m Initiative now. It�s free. http://im.live.com/messenger/im/home/?source=TAGHM_June07 ...

Re: Matching records from data set one with records from data set #2
On Mon, 22 Jan 2007 12:37:28 +0100, erik christiansen <ec@SELVMORDSFORSKNING.DK> wrote: >Hi > >I need to match records from data set one with records from data set two. I >can only match records from data set two to a single record in data set one. >Therefore i need to delete the record in data set two or show that it has >been used, and thererfore can not be used again. Have do i do that? > >I have been trying some thing like this: > >Data newdataset; > set one; > found=0; > do i=1 to nobs until (found); > set two point=i nobs=nobs; > if var1=var2 (the matching criteria) then do; > output; > found=1; > ***I need to delete the record in data set two which returns >true for the test: var2=var1*** > end; > end; >run; > >Thanks > >Erik Christiansen, Denmark MERGE is usually the tool for this type of problem. If I understand, ONE and TWO are something like data one; input var1 track1; cards; 1 111 1 112 2 121 2 122 2 123 3 131 ; data two; input var2 track2; cards; 1 211 1 212 1 213 2 221 2 222 4 241 ; The straightforward merge is then like this data simple_merge; merge one(rename = (var1=byvar) in=inone) two(rename = (var2=byvar) in=intwo); by byvar; match = inone and intwo; run; The result is byvar track1 track2 match 1 ...

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: Data Lost questions while combing several data sets using set #2
Nancy, Your variable C is being truncated in the DATA B data step, not when combining data sets. Putting a PROC PRINT in after DATA A and DATA B will show you this. One way to correct the issue is to eliminate one of the spaces separating values in the datalines. If you have fixed-width input files, you could use column input or pointer controls on your input statement. Jack Clark Senior Research Analyst phone: 410-455-6256 fax: 410-455-6850 jclark@hilltop.umbc.edu University of Maryland, Baltimore County Sondheim Hall, 3rd Floor 1000 Hilltop Circle Baltimore, MD 21250 Confidentiality Notice: This e-mail may contain information that is legally privileged and that is intended only for the use of the addressee(s) named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying of this e-mail, distribution, or action taken in reliance on the contents of this e-mail and/or documents attributed to this e-mail is strictly prohibited. If you have received this information in error, please notify the sender immediately by phone and delete this entire e-mail. Thank you.-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Nancy Sent: Wednesday, March 04, 2009 9:38 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Data Lost questions while combing several data sets using set statement Could you please tell me what is wrong with following program? My data was cutted when I tried to append them toghter...

Re: VIEWTABLE: Display Data Set Name Instead of Data Set Label #2
I haven't followed this discussion from the other thread to this one very closely because I don't use VT much. However my limited testing just now indicates that the SAS system option NOLABEL is "honored" by VT. I can turn it off(NOLABEL) to see variable names or on(LABEL) to see labels. I can even VT the same table in two different VTs open at the same time one with labels the other without. On 10/5/07, T J <tj_noreply@yahoo.com> wrote: > Well AF/FSP are not available to me. Here is my work-around - delete all > dataset labels in the WORK library. > > Put this little macro either inside your SASAUTO lib path or inside your > autoexec.sas: > > > %macro Del_TabLabels; > %global modify_tables ; > proc sql noprint; > select "modify " ||trim(memname)||"(label=' ')" > into :modify_tables > separated by "; " > from sashelp.vtable > where libname='WORK' and memtype='DATA' ; > quit; > > proc datasets library=WORK nolist; > &modify_tables ;; > run; > quit; > %mend Del_TabLabels; > > > Then you can run a one-liner "%Del_TabLabels" somewhere in your program, or > define a function key in your PGM's KEYS window such as: > > SHFT-F12 submit '%Del_TabLabels'; > > Press this function key would strip off all dataset labels in the WORK lib. > Using the function key is p...

Re: search SAS data set from SAS code #2
Rose, The answer to your question depends on your operating system. In Windows, there's the Search tool. In Unix/Linux, you can use grep Bob Abelson HGSI 240 314 4400 x1374 bob_abelson@hgsi.com Rose <myr_rose@YAHOO.COM> Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> 04/19/2005 11:13 AM Please respond to myr_rose To: SAS-L@LISTSERV.UGA.EDU cc: Subject: search SAS data set from SAS code Hi All, Suppose I have a sas permanent data set which was created early, I know the library path but I couldn't remember in which sas program code I created it. how can I search from so many sas program files in different folders and find it. thanks in advance. Rose ...

Re: Compressing data sets (was Re: [SAS-L]) #2
OK, "you or a program on your behalf will have to decompress them before use". -- JackHamilton@FirstHealth.com Manager, Technical Development Metrics Department, First Health West Sacramento, California USA >>> "Richard Graham" <richardwgraham@earthlink.net> 01/05/2004 5:04 PM >>> Actually you can compress(WINZIP, PKZIP) SAS data sets and use them in the compressed format. There is software named ZipMagic which allows zip files to be used as windows folders. I have done this with mixed results when the underlying data set is upwards of 4GB. Bu...

Re: Modifying SAS Data Sets in the SET command #2
Hi Sober (do you have a real name?) - Looks good, but you can't perform an assignment function in a set statement whereas you can use a function in a where comparison. Where clauses are processed before the data is read into the data vector, so generally for tables with many variables, where processing can save substantial IO overhead. 1 data A; 2 col1='2003'; 3 col2='a'; 4 col3='b'; 5 col4='c'; 6 output; 7 8 NOTE: The data set WORK.A has 1 observations and 4 variables. NOTE: DATA statement used: real time 0.03 seconds cpu time 0.00 seconds 9 Data B(drop=col1); 10 Set A (rename=(col4=colFOUR) WHERE=(col1="2003")); 11 col2 = UPCase(col2); 12 13 put _all_; 14 run; col1=2003 col2=A col3=b colFOUR=c _ERROR_=0 _N_=1 NOTE: There were 1 observations read from the data set WORK.A. WHERE col1='2003'; NOTE: The data set WORK.B has 1 observations and 3 variables. NOTE: DATA statement used: real time 0.03 seconds cpu time 0.00 seconds SAS-L is a great place to learn, you may want to search on "newbie data step" at http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&group=comp.soft- sys.sas There are plenty of papers at http://www.lexjansen.com/sugi/index.htm http://www.sconsig.com/sastip.htm and last but not least http://support.sas.com/ There is a SAS tutoral at UCLA that p...

Re: Reading SAS data sets on UNIX by non-SAS apps
John: Dataflux is now marketing DBMSCOPY or Unix. See http://www.dataflux.com/Product-Services/Products/dbms.asp Sig -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of John Bentley Sent: Monday, October 18, 2004 10:10 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Reading SAS data sets on UNIX by non-SAS apps I have SAS data sets on AIX that we need to read with Unica's Affinium campaign management software, also on a UNIX box. (Let's not get into why we didn't go with the SAS Solution.) SAS Institute doesn't supply an ODBC driver for the UNIX environment, and the Affinium implementors don't want to use the SAS SQL Library for C and or deal with APIs. Other that dumping the SAS data sets as flat files, can anyone suggest a solution? Thanks in advance for the help. ...

Web resources about - Re: How to read desired data from raw data set (with example)? #2 - comp.soft-sys.sas

It caused heartbreak, but one-child policy's end may not achieve desired effect
A restless toddler squirming in his grasp, China's abolition of its one-child policy could not be further from Ma Qingtian's mind.

It caused heartbreak, but one-child policy's end may not achieve desired effect
A restless toddler squirming in his grasp, China's abolition of its one-child policy could not be further from Ma Qingtian's mind.

Tim Lane: AFL match review panel secrecy leaves a lot to be desired
Last Monday's verdict on Nathan Fyfe probably won a rare tick of approval from the public for the match review panel. Yet it should be an outcome ...

Government beating up budget crisis to sell desired cuts, says economist Raja Junankar
A senior academic economist says the Federal Government is beating up the budget crisis to sell unnecessary cuts.

Kate Middleton Baby Bump Fashion Tops ‘Most Desired' Celebrity Wardrobe Poll (PHOTOS)
... hasn’t put a kink in her style, and fashionistas seem to love her for it. The pregnant Duchess of Cambridge was crowned winner of a ‘Most Desired’ ...

Boredom Is Desired, Becasue It Means Change Is Imminent
... in it, Sullivan is right to chastise. But the objective is to transcend boredom, not wallow in it. You just finished reading Boredom Is Desired, ...

Apple's iPhone is most-desired smartphone in emerging markets, passing Samsung
While many customers in emerging markets may not be able to afford an iPhone, they'd still prefer it over competing devices running Google's ...

Encryption isn’t at stake, the FBI knows Apple already has the desired key
(credit: flattop341 ) Apple has been served with a court order at the FBI's request, demanding that it assist the government agency with unlocking ...

Generic Range of Equity Desired By a VC for Round 1 or 2
Jason and I welcome Matt McCall from DFJ Portage as today’s guest VC blogger. We sent Matt one of our backlog questions – his response is

That Was Quicker Than Desired
And the Pirates playoff run had a life expectancy about as long as a Sean Bean role. Share This space reserved for your ad.

Resources last updated: 3/18/2016 7:08:24 PM