Re: Data set problems and basic understanding of SAS #2On Wed, 13 Jul 2005 19:37:55 -0400, Robert Slotpole <rslotpole@COMCAST.NET>
wrote:
>I keep working through the tutorials but there are so many of them. I know
>this is a verry basic question but just the same any and all help greatly
>appreciated.
OK. But posting essentially the same question multiple times under
different subject headings isn't really going to accomplish much.
>In my main table D6 I have 200 observations consisting of 40 tickers
>repeated for each of 5 dates. I issue a proc summary by date and get 5
>observations (1 for each date) that I now want to add to one of the
tickers.
>The code I tried was:
>
>proc summary data=d6;
> var dollar_div;
> by date;
> output out=d7 sum=total_dol_div;
> run;
>
>data d7;
> set d7;
> keep total_dol_div;
> run;
What you've done here is create a new D7 from the existing D7. The KEEP
preserves TOTAL_DOL_DIV but by implication sheds DATE (which I think you'll
need) and _TYPE_ and _FREQ_ (automatic variables created by PROC SUMMARY,
which you probably won't need). You've also missed an opportunity to add
the variable TICKER, which I think you will need (see below).
I suggest:
data d7;
set d7;
drop _type_ _freq_;
ticker = '*$$$';
run;
>data d8;
> set d6;
> if ticker = '*$$$' then trade = trade + total_dol_div;
> run;
>
>I thought the keep command would keep total_dol_div but I get: NOTE:
>Varia...
Data set problems and basic understanding of SAS part 2In following up on my previous post I can create and merge the data:
the following output shows what I mean:
total_ total_ total_
Obs DATE TICKER endshare dol_div sales purchases
1 2002-12-31 *$$$ 0.0 0.0 9617604 -9617604
2 2002-12-31 ABT 5700.0 0.0 9617604 -9617604
3 2002-12-31 AMAT 0.0 0.0 9617604 -9617604
.
.
.
39 2002-12-31 WMT 6300.0 0.0 9617604 ...
Re: How to filter sas data sets into separate sas data sets #2you 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: Data set problems and basic understanding of SASRobert,
I am slightly confused as to what you are trying to do over all but let me
say this:
Should this :
proc summary data=d6;
var dollar_div;
by date;
output out=d7 sum=total_dol_div;
run;
data d7;
set d7;
keep total_dol_div;
run;
data d8;
set d6;
if ticker = '*$$$' then trade = trade + total_dol_div;
run;
be this:
proc summary data=d6;
var dollar_div;
by date;
output out=d7 sum=total_dol_div;
run;
data d7;
set d7;
keep total_dol_div;
run;
data d8;
set d7; <-----Notice that I changed d6 to d7 so that the incoming data
will be the data from the proc summary and that data should have your
variable 'total_dol_div.
if ticker = '*$$$' then trade = trade + total_dol_div;
run;
Toby Dunn
From: Robert Slotpole <rslotpole@COMCAST.NET>
Reply-To: Robert Slotpole <rslotpole@COMCAST.NET>
To: SAS-L@LISTSERV.UGA.EDU
Subject: Data set problems and basic understanding of SAS
Date: Wed, 13 Jul 2005 19:37:55 -0400
I keep working through the tutorials but there are so many of them. I know
this is a verry basic question but just the same any and all help greatly
appreciated.
In my main table D6 I have 200 observations consisting of 40 tickers
repeated for each of 5 dates. I issue a proc summary by date and get 5
observations (1 for each date) that I now want to add to one of the tickers.
The code I tried was:
proc summary data=d6;
var dollar_div;
by date;
output out=d7 sum=total_dol_div;
r...
Re: How to filter sas data sets into separate sas data setsLizette,
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 #5Lizette:
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 #6First 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 #4Something 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 #7Summary: 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 #3Lizette,
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 #8On 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: search SAS data set from SAS code #2Rose,
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: Reading SAS data sets on UNIX by non-SAS apps #2John:
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: problem with large sas data sets #2But, is there a "different" system between the 2 unixes? Or, is the SAS
dataset being copied to another drive within the same system?
j.
Shiping Wang wrote:
> I use Sas under unix system.
>
> On 4/21/08, *Jim Agnew* <agnew@vcu.edu <mailto:agnew@vcu.edu>> wrote:
>
> hhmm.. are you crossing operating systems, like a windows or vms
> inbetween unix hosts? is there FTP involved anywhere and it's
> sending binary as ascii? is the network link bad?
>
> sas_9264 wrote:
>
> Hi, sometimes I have a problem to use unix command to copy, mv
> or soft
> link large sas data set(over 4-5 GB). After I do that, I cann't open
> that data anymore . Sas complain that ERROR: The open failed because
> library member TEMP.XXXXXX_XX041608.DATA is damaged.Does anyone has
> similar experience?
>
> Thanks,
>
> Shiping
>
>
> --
>
> "Games? Solitaire? I have a 2-node VAXcluster, 3 Windows 2000
> servers, 2 Windows 2003 servers, 1 MySQL Database Server, 1 Postgres
> Database Server, 1 Linux server, several Ubuntus and a direct
> satellite feed to my windows desktop background, who needs toys???"
> - Jim
>
>
--
"Games? Solitaire? I have a 2-node VAXcluster, 3 Windows 2000 servers, 2
Windows 2003 servers, 1 MySQL Database Server, 1 Postgres Database
Server, 1 Li...
Re: How to filter sas data sets into separate sas data s etsI 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: Compressing data sets (was Re: [SAS-L]) #2OK, "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 #2Hi 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: XML data to SAS data set converstion #2A 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: Compressing data sets (was Re: [SAS-L]) #2 #6A 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...
Re: Compressing data sets (was Re: [SAS-L]) #2 #4It's not a big deal, but there is a difference between reading a file
directly and having another program as an intermediary, and someone
someday is going to get into trouble because they didn't take that into
account.
I'm not sure what you mean by "using SAS/Connect to read non-SAS
files".
--
JackHamilton@FirstHealth.com
Manager, Technical Development
Metrics Department, First Health
West Sacramento, California USA
>>> "Bruce Johnson" <bjohnson@SOLUCIENT.COM> 01/06/2004 9:36 AM >>>
But if another program is doing it, within SAS, wh...
Re: Compressing data sets (was Re: [SAS-L]) #2 #7I'm crazy..yes, SAS/Access...not Connect...
________________________________
Bruce A. Johnson
bjohnson@solucient.com
-----Original Message-----
From: Jack Hamilton [mailto:JackHamilton@firsthealth.com]
Sent: Tuesday, January 06, 2004 1:22 PM
To: SAS-L@LISTSERV.UGA.EDU; Bruce Johnson
Subject: Re: [SAS-L] Compressing data sets (was Re: [SAS-L])
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...
Re: search SAS data set from SAS code> From: Rose
> 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.
a problem familiar to all of us delayed-housekeeping folks.
Libname Libref '<directory-specification>';
DATA LibRef.DataSetName;
use your system utilities to search for the dir-spec
of your libref.
search: *.sas
containing text: <dir-spec>
once you have found the libname allocation
then search for the Libref
search: *.sas
containing text: Libref.DataSetName
Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov
...
Re: Deleting SAS Data from a SAS DATASET #2Chandra - this isn't my expertise area - I'm sure others may have better
ideas but I'll make three comments.
If your datasets have a large number of variables, in your datastep
method a WHERE clause will be more efficient - the IF statement causes
each record to be fully read before it can be selected for deletion. A
WHERE clause would only read the single variable in the case of records
that meet the criteria for deletion.
Data prod.Master_date;
set prod.master_date;
where snap_dt ne "&end_dt"d;
run;
You probably would be better off changing your data model though - my
first thought would to be to store your data as separate yearly or
monthly files and then access them with a view of the past two years or
24 months. With each month or year you would delete the oldest file and
change the view one time period forward.
*set up the data;
data time1 time2 time3 time4;
do i = 1 to 100;
do t = 1 to 4;
if t=1 then output time1;
if t=2 then output time2;
if t=3 then output time3;
if t=4 then output time4;
end;
end;
run;
*three successive example views;
data filet1 / view=filet1;
set time1 time2;
run;
data filet2 / view=filet2;
set time2 time3;
run;
data filet3 / view=filet3;
set time3 time4;
run;
One more thought - since the data are appended - if the file is not
reordered and you have the record counts from each append - then you can
use firsto...
Re: search SAS data set from SAS code #5Rose,
You have some good advice on search techniques, but they may beinadequate.
I hope your LIBNAME wasn't something like
libname lib "&dir" ;
Perhaps you should also search for ".member", but that also couldhave the same problem. You might also look for key variablenames or values, or procedures that you know created the data.The date from a PROC CONTENTs might provide useful information,or an old report created by the same program with a footnote,"Source code: ...".
Maybe
data lib.w ( label="created by ..." ) ;
would be a good habit to develop in the future. Then goodorganization also helps.
Sorry, I haven't got a good solution, but it is possible to learnfrom mistakes and wise to do so. Otherwise, they tend to getrepeated.
Ian Whitlock===================
Date: Tue, 19 Apr 2005 08:13:41 -0700
Reply-To: myr_rose@YAHOO.COMSender: "SAS(r) Discussion"
From: Rose <myr_rose@YAHOO.COM>Organization: http://groups.google.com
Subject: search SAS data set from SAS codeComments: To: sas-l
Content-Type: text/plain; charset="iso-8859-1"
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
...