Re: Converting Macro Variable to a SAS Dataset Variable #2
Sounds like you should address this at the step where you create the macro
variable; instead of creating a macro variable, create a dataset (or a
dataset variable). (I assume this is related to your other query, which
indicates that you create this macro variable in PROC SQL).
Can you post some code and sample data for how you arrive at &p1 in the
On Wed, Mar 18, 2009 at 10:22 AM, Siddharth Jain <firstname.lastname@example.org>wrote:
> If I have a macro variable p1 where %put <<p1>>; results in <<p1>>
> How do I bring value of p1 to a dataset. Can I make a dataset variable
> has the same values as of p1.
> Thanks in advance for your help,
...Re: Deleting SAS Data from a SAS DATASET #2
Chandra - 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.
where snap_dt ne "&end_dt"d;
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;
*three successive example views;
data filet1 / view=filet1;
set time1 time2;
data filet2 / view=filet2;
set time2 time3;
data filet3 / view=filet3;
set time3 time4;
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: Ordering Variables in SAS Dataset
Try having retain statement before SET as in:
retain age name sex;
On Thu, Mar 20, 2008 at 9:02 AM, DaDoctor <email@example.com>
> Fellow Members:
> I am working ordering a SAS dataset and thought I could use the retain
> statement for this purpose.
> However, the process is bombing.
> data temp_dset;
> set out.perm_dset;
> retain var1 var2.........;
> suggestions on what I am doing wrong?
On Mar 20, 9:23=A0am, muthia.kachira...@GMAIL.COM (Muthia Kachirayan)
> Try having retain statement before SET as in:
> data a;
> retain age name sex;
> =A0 =A0set sashelp.class;
> On Thu, Mar 20, 2008 at 9:02 AM, DaDoctor <brett.a.summ...@bankofamerica.c=
> > Fellow Members:
> > I am working ordering a SAS dataset and thought I could use the retain
> > statement for this purpose.
> > However, the process is bombing.
> > syntax:
> > data temp_dset;
> > =A0set out.perm_dset;
> > =A0 retain var1 var2.........;
> > run;
> > suggestions on what I am doing wrong?- Hide quoted text -
> - Show quoted text -
I am good to go! Not sure why I didn't catch that. thanks!
...Re: SAS Macro to delete a SAS dataset #2 313487
I too like(d) PROC DELETE.
When I used it I was forced to remove it and use PROC DATASETS because
PROC DELETE is not documented.
Also, but I have not tested it. How does it work with indexed data
sets, audit trails, generation data groups, views, etc.?
I don't worry much about deleting, "all" of my programs run in batch
and are obsolete as soon as they are written.
On 12/3/09, Fehd, Ronald J. (CDC/CCHIS/NCPHI) <firstname.lastname@example.org> wrote:
> > From: SAS Techies
> > Subject: SAS Macro to delete a SAS dataset
> > Here's a simple SAS...Re: urgent : Convert SAS array in to sas variables #2
On Sat, 3 May 2008 23:34:44 -0700, Shailesh <shailesh.tewari@GMAIL.COM> wrote:
>In my dataset I have an array variable , say A which has values like
>Observation 1 - A= 23 ,A=34, A=45
>Observation 2 - A= 23 ,A=34, A=45
>I want to create sas variables which should have name A61, A62 , A63,
>Similarly for second observation these would be A71, A72,
>A73 , A74.........
>in the same datastep.
>Any help ?
Arrays are DATA *step* structures. They do not exists in data *sets*. Please
post an example showing the data set you have and what you need (or think
...Re: Is it possible to read a sas dataset NOT using sas? #2
I think SPSS and DBMSCopy can read SAS datasets. Also for sure WPS.
On Tue, 18 Mar 2008 06:43:44 -0700, RolandRB <rolandberry@HOTMAIL.COM>
>Is it possible to read a sas dataset NOT using sas and have
>observations and variables etc. rather than having meaningless chunks
...Re: Ordering Variables in SAS Dataset #3
Place the RETAIN before the SET...
On Thu, 20 Mar 2008 06:02:24 -0700, DaDoctor
>I am working ordering a SAS dataset and thought I could use the retain
>statement for this purpose.
>However, the process is bombing.
> set out.perm_dset;
> retain var1 var2.........;
>suggestions on what I am doing wrong?
...Re: Storing SAS-programs and -macros in SAS-datasets on a HOST-platform #2
How about catalogs? They are already used for macros. I believe other code
could be used via %INCLUDE.
On Tue, 5 Oct 2004 09:57:46 -0700, Jesper Sahner <jespersahner@HOTMAIL.COM>
>Ususally SAS-programs and -macros on a HOST-platform are stored in
>PDS-datasets, which are not SAS-datasets. However I am interested in
>storing programs in a regular SAS-dataset in the same way tables and
>formats are stored. Is that possible? (this should be easy in SCL -
>which I am not familiar with - but how do you do it in Base-SAS?
>I believe that storing pro...Re: SAS/ACCESS
DBMAX_TEXT does the trick; thank you all who helped!
From: Jack Hamilton [mailto:email@example.com]
Sent: Sat 1/24/2009 1:42 AM
To: Pettis, Matthew (Prof II&RS)
Subject: Re: [SAS-L] SAS/ACCESS - Oracle: setting field lengths in SAS datasets returned from passthrough
Does the DBMAX_TEXT option do what you want?
Videtis illam spirare libertatis auram
On Jan 22, 2009, at 8:57 am, Matthew Pettis wrote:
> I have a CLOB coming back from an Oracle passthrough query that is
> in length. How do I specify that my receiving variable in a SAS
> be longer than 1024 characters to accommodate this? By default, I get
> SAS thinking that this is 1024 characters, when it is really a CLOB
> I want to set some large default length on this variable length...
...Re: suggest: improve SAS Deployment Wizard for SAS v9.2, phase 2 #2
> From: A Little Birdie
> I just searched the SAS-L archives (should have done that
> first) and found references to these two pages:
> Have you seen this page?
> http://support.sas.com/kb/35/631.html <---<<< NICE!
> It looks like it addresses your needs, and might be something
> nice to add to the SASCo...Re: How to read a period in a variable from a file to SAS dataset #2
On Mon, 28 Jul 2008 02:01:10 -0700, =?ISO-8859-1?Q?Rune_Runnest=F8?=
>This is the file with the fileref MYFILE:
>DOKTITTEL: this is the first record
>DOKTITTEL: this is the third record
>I want the second record to be '.', not ' '.
>How can I obtain that?
>filename myfile "d:\temp\myfile.txt";
> length Dokumentbeskrivelse $40. ;
> infile myfile dlm=">>>" pad ;
> input @"DOKTITTEL:" dokumentbeskrivelse ;
Use the $CHAR informat.
...Re: combine n SAS datasets in to one SAS dataset.
If you use the dictionary tables try Proc SQL - it will run much more
quickly than a datastep:
proc sql noprint;
select MemName into :MemList
separated by " &lib.."
and MemName eqt upcase("&mem");
DDS Data Extraction
From: SAS(r) Discussion [mailto:SAS-L@L...Re: MVS Merge Variable Data Using SAS Merge or SAS SQL JOIN #2
You may want to consider using nested queries to create the keys that you
need to join the tables? That gives the SQL compiler a way to bound the
search space. For example,
create table temp as
from (select <key transformation>,* from small) as t1
left join (select <key transformation>,* from large) as t2
on t1.<transformed key> EQT t2.<transformed key>
Now the SQL compiler has two keys from the same domain that it can index or
use as sort keys. This method works with composite keys as well. Just make
sure that the <transformed key> v...Re: Create SAS file with specific order of variables #2
On Wed, 15 Aug 2007 16:47:34 +0200, "Will" <schimpanski@GMX.DE> said:
> I'd like to create a SAS data file with sorted variable names.
In general, there's no way to tell SAS to order variable names in a
particular way, other than by giving it a list of the variable names in
the order you want them.
There are some exceptions, but it's rare for SAS to care about the
stored order of variables. If you want the variables in a particular
order for output, there are ways to do that, but that varies by
procedure. Why do you want to do this?
> How ca...Re: comparing pdf files and SAS Datasets for variables... #2
If I was in your shoes, I would try to convert the PDF to Excel so I could
more easily manipulate and clean up the data. There are a number of products
out there but a free one you can try (not tested myself) can be found at:
SAS & WPS Consulting and WPS Reseller
Tel: (614) 457-3714
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Al
Sent: 02/11/2009 5:52 PM
Subject: comparing pdf files and SAS Datasets for variables...
I don't know if this possible or not but here it is ..Is there a way
to compare a case report forms (in pdf format ) and SAS datasets to
know if all the variables listed in the crfs are present in the SAS
datasets through a SAS Program..
I have around 40 CRF's for each of the 4 protocols.. its tedious
doing manually ..
Please direct me in the right direction..
Thanks in advance .
Thanks for the replies -- most informative and helpful.
...Re: R vs. SAS (was Replacement for SAS (SPSS vs. SAS, redux)) #2
Sounds like R is the SAS equivalent of Linux .. who are incidentally in all
sorts of a copy left/right mess at the moment.
On Thu, 5 Feb 2004 09:39:37 -0500, Peter Flom <flom@NDRI.ORG> wrote:
>I use both SAS and R; I"ve used SAS for 10 or 15 years, R for about 6
>months - 1 year.
>Each has strengths and weaknesses; I'd not like to give up either.
>Strengths of SAS (esp. compared to R)
>Tech support - I have SAS tech support's phone number and our license
>number memorized. They're great.
>SAS-L - There's also an R-help list...Re: combine n SAS datasets in to one SAS dataset. #4
Filename allfiles ('d:\conv\2008*.asc'); * Filenames can use
At 10:53 AM 1/14/2009, firstname.lastname@example.org wrote:<br>
<blockquote type=cite class=cite cite="">Hi,<br>
I have a similar problem in my SAS macro;<br>
I have many ascii files where name are 2008011.asc to 2008123<br>
year = 2008, month=01 to 12 and dekad = 1 to 3;<br>
To import all my files, I have writed 2 similars macro contain
<x-tab> </x-tab>%Do i= 1
<x-tab> </x-tab>%DO j = 1
%let dataname ="d:\conv\20080&i&j.asc";<br>
and for second<br><br>
<x-tab> </x-tab>%Do i= 10
<x-tab> </x-tab>%DO j = 1
%to &dekad;...Re: SAS Sample 1728 Was ---> Re: SAS Sample 1727 #2
I am not sure that the SI Tech Support examples should have all the error
checking that Chang wanted to throw in the macro. The examples should be
clear concise and easy to read and get going, as well as be illistrative.
Too much error checking in an example well is just over kill and even
detrimental to an example. However, any code solution on the SI Tech
Support web sit should follow basic rules of good practices and sound
advice. Such as with thier macros having atleast a somewhat good Macro
Look at Example SAS Sample 1728:
The first method well lets say is soooo bad...Re: Converting Macro Variable to a SAS Dataset Variable
Refer to my previous answer; if you put them in a data set then =
the data set, you avoid macro variables altogether. However, to answer =
informat p1 8.;
To assign character variables, use the macro variable in double quotes
informat char_var $20.;
----- Original Message -----=20
From: Siddharth Jain=20
Sent: Wednesday, March 18, 2009 10:22 AM
Subject: Converting Macro Variable to a SAS Dataset Variable
If I have a macro variable p1 where %put <<p1>>; results in <<p1>> =
How do I bring value of p1 to a dataset. Can I make a dataset variable =
has the same values as of p1.
Thanks in advance for your help,
...Re: Sas Question (Re-organizing dataset) #2
Here's a simplistic alternative. It provides the indicated ordering of the
data need(keep = name code amount);
set code(rename = (code1=code) );
code = code2; output;
code = code3; output;
On Mon, 18 Sep 2006 19:43:46 -0400, data _null_; <datanull@GMAIL.COM> wrote:
>Perhaps this can be adapted to your needs. You may want to rename
>COL1 and drop _NAME_.
> input name:$8. (code1-code3)(:$3.) amount:comma8.;
> format amount dollar8.0;
>Leroy X13 H42 G91 $4,900
>Mary...Re: suggest: improve SAS Deployment Wizard for SAS v9.2, phase 2
Subject: Re: v9.2 phase 2, page update
"Make the installation of SAS BI Server easier!"
Just remember that the majority of us are still just installing only
SAS Foundation v9.2, and possibly Enterprise Guide v4.2
My rant/suggestion to Tech Support has been addressed.
I have added notes about my conversation with Tech Support
to this sas community wiki page:
summary: if you have Build # greater than or equal to 28
then you can dispense with ForceInstall.
Ronald J. Fehd, IT Spec
HelpDesk Level 3: SAS
CDC S...Re: SAS System Viewer 9.1 unable to open SAS datasets ( SAS 9.1.3)
A question in return:
is your table from windows? compressed from another system?
and specially with personnel formats hard coded inside?
msiddu2000 a �crit :
> SAS System Viewer 9.1 was able to open datasets that were created by
> V8 engine (SAS 8.2), but is unable to open datasets that are created
> with V9 engine (SAS 9.1.3).
> Does this need SAS System Viewer to be upgraded ?
> Something else needs to be done ?
INED (Institut National d'Etudes D�mographiques)
133 Boulevard Davout 75980 Paris Cedex 20
m�l : email@example.com t�l : 33 (0) 1 56 06 21 54
...Re: Converting Macro Variable to a SAS Dataset Variable #3
Send mail to the list not a person on the list!
keep subjid lastresc1;
keep subjid lastresc222;
keep subjid lastresc777;
merge visit1 visit222 visit777;
Proc Transpose could also be used on your first data set to flip it.
----- Original Message -----
From: Siddharth Jain
Sent: Wednesday, March 18, 2009 10:59 AM
Subject: RE: Converting Macro Variable to a SAS Dataset Variable
Thanks for your response. Below is the code I have up till now:
Per subjid per visit per organ code, I have to see whether result is
changing or not.
if lacat in ('NTL') and subjid in ('101-001');
keep subjid visitnum lasitcd lastresc;
select distinct LASTRESC into :p1 separated by ',' from la11 where
visitnum eq 1;
select distinct LASTRESC into :p2 separated by ',' from la11 where
visitnum eq 222;
select distinct LASTRESC into :p3 separated by ',' from la11 where
visitnum eq 777;
%put <<p1>> &p1 <<p2>> &p2 <<p3> &p3;
From: Mary [mailto:firstname.lastname@example.org]
Sent: Wednesday, March 18, 2009 11:54 AM
To: Siddharth Jain; SAS-L@LISTSERV.UGA.EDU
Subject: Re: Converting Macro Variable t...