f



Re: Ordering Variables in SAS Dataset #2

The SET and RETAIN statements are in the wrong order.

On Thu, Mar 20, 2008 at 8:02 AM, DaDoctor
<brett.a.summers@bankofamerica.com> wrote:
> 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;
>  set out.perm_dset;
>   retain var1 var2.........;
>
> run;
>
>
> suggestions on what I am doing wrong?
>
0
datanull (3025)
3/20/2008 1:09:49 PM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

0 Replies
524 Views

Similar Articles

[PageSpeed] 15

Reply:

Similar Artilces:

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 first place? -Joe On Wed, Mar 18, 2009 at 10:22 AM, Siddharth Jain <sjain@aveopharma.com>wrote: > If I have a macro variable p1 where %put <<p1>>; results in <<p1>> > 01,02,03,06 > > > How do I bring value of p1 to a dataset. Can I make a dataset variable > which > has the same values as of p1. > > > Thanks in advance for your help, > Siddharth > ...

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. 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: Ordering Variables in SAS Dataset
Try having retain statement before SET as in: data a; retain age name sex; set sashelp.class; run; On Thu, Mar 20, 2008 at 9:02 AM, DaDoctor <brett.a.summers@bankofamerica.com> wrote: > 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; > set out.perm_dset; > retain var1 var2.........; > > run; > > > suggestions on what I am doing wrong? > On Mar 20, 9:23=A0am, muthia.kachira...@GMAIL.COM (Muthia Kachirayan) wrote: > Try having retain statement before SET as in: > > data a; > retain age name sex; > =A0 =A0set sashelp.class; > run; > > On Thu, Mar 20, 2008 at 9:02 AM, DaDoctor <brett.a.summ...@bankofamerica.c= om> > wrote: > > > > > 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) <rjf2@cdc.gov> 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[1]= 23 ,A[2]=34, A[3]=45 >Observation 2 - A[11]= 23 ,A[12]=34, A[13]=45 > >I want to create sas variables which should have name A61, A62 , A63, >A64 .......... >Similarly for second observation these would be A71, A72, >A73 , A74......... > > >in the same datastep. > >Any help ? > >Regards, >Shailesh 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 you need). ...

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. Gerhard On Tue, 18 Mar 2008 06:43:44 -0700, RolandRB <rolandberry@HOTMAIL.COM> wrote: >Is it possible to read a sas dataset NOT using sas and have >observations and variables etc. rather than having meaningless chunks >of text? ...

Re: Ordering Variables in SAS Dataset #3
Place the RETAIN before the SET... Gerhard On Thu, 20 Mar 2008 06:02:24 -0700, DaDoctor <brett.a.summers@BANKOFAMERICA.COM> wrote: >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; > set out.perm_dset; > retain var1 var2.........; > >run; > > >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> wrote: >Hi! > >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! Matt -----Original Message----- From: Jack Hamilton [mailto:jfh@stanfordalumni.org] Sent: Sat 1/24/2009 1:42 AM To: Pettis, Matthew (Prof II&RS) Cc: SAS-L@LISTSERV.UGA.EDU 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? http://support.sas.com/onlinedoc/913/getDoc/en/acreldb.hlp/a003113591.htm -- Jack Hamilton jfh@alumni.stanford.org Videtis illam spirare libertatis auram On Jan 22, 2009, at 8:57 am, Matthew Pettis wrote: > Hi, > > > > I have a CLOB coming back from an Oracle passthrough query that is > >1024 > in length. How do I specify that my receiving variable in a SAS > dataset > 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 > and > I want to set some large default length on this variable length... > > > > Thanks, > Matt ...

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: > > http://www.sascommunity.org/wiki/Category:V9.2_Phase_2 > > http://www.sascommunity.org/wiki/V9.2_Phase_2_install_guide > > 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?= <rune@FASTLANE.NO> wrote: >/* >This is the file with the fileref MYFILE: > >--------------------------------------- >DOKTITTEL: this is the first record >--------------------------------------- >DOKTITTEL: . >--------------------------------------- >DOKTITTEL: this is the third record >--------------------------------------- >*/ > >/* >I want the second record to be '.', not ' '. >How can I obtain that? > >Rune >*/ >filename myfile "d:\temp\myfile.txt"; > >data tp34_jn_dok; > length Dokumentbeskrivelse $40. ; > infile myfile dlm=">>>" pad ; > input @"DOKTITTEL:" dokumentbeskrivelse ; >run; 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: %let lib=YourLib; %let mem=file2007; proc sql noprint; select MemName into :MemList separated by " &lib.." from dictionary.tables where LibName=upcase("&lib") and MemType='DATA' and MemName eqt upcase("&mem"); quit; data &lib.File_History; set &lib.&MemList; run; hth Paul Choate DDS Data Extraction (916) 654-2160 -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@L...

Re: MVS Merge Variable Data Using SAS Merge or SAS SQL JOIN #2
A: 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, proc sql; create table temp as select * 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: > Hi, > > 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: http://www.brothersoft.com/office-convert-pdf-to-excel-for-xls-free-204767.h tml TinyURL: http://tinyurl.com/cutu96 Phil Philip Rack MineQuest, LLC SAS & WPS Consulting and WPS Reseller Tel: (614) 457-3714 Web: www.MineQuest.com Blog: www.MineQuest.com/WordPress -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Al Sent: 02/11/2009 5:52 PM To: SAS-L@LISTSERV.UGA.EDU Subject: comparing pdf files and SAS Datasets for variables... Hi , 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 . ...

Re: Confused
Thanks for the replies -- most informative and helpful. JG ...

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
<html> <body> <br> Filename allfiles ('d:\conv\2008*.asc');&nbsp; * Filenames can use wildcards;<br><br> infile allfiles;<br><br> <br><br> <br> At 10:53 AM 1/14/2009, b.djaby@gmail.com 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&nbsp; 2008011.asc to 2008123<br> &nbsp;year = 2008, month=01 to 12 and dekad = 1 to 3;<br> To import all my files, I have writed 2 similars&nbsp; macro contain with<br> those code:<br> %LET month=9;<br> %LET dekad=3;<br> <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>%Do i= 1 %to &amp;month;<br> <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>%DO j = 1 %to &amp;dekad;<br> %let dataname =&quot;d:\conv\20080&amp;i&amp;j.asc&quot;;<br> infile &amp;dataname;<br> ****<br> and for second<br><br> %LET month=12;<br> %LET dekad=3;<br> <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>%Do i= 10 %to &amp;month;<br> <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>%DO j = 1 %to &amp;dekad;...

Re: SAS Sample 1728 Was ---> Re: SAS Sample 1727 #2
Graham , 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 design. 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 = transpose the data set, you avoid macro variables altogether. However, to answer = the=20 question: data newtable; informat p1 8.; p1=3D&p1; run; To assign character variables, use the macro variable in double quotes informat char_var $20.; char_var=3D"&macro_var"; -Mary ----- Original Message -----=20 From: Siddharth Jain=20 To: SAS-L@LISTSERV.UGA.EDU=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>> = 01,02,03,06 How do I bring value of p1 to a dataset. Can I make a dataset variable = which has the same values as of p1. Thanks in advance for your help, Siddharth ...

Re: Sas Question (Re-organizing dataset) #2
Here's a simplistic alternative. It provides the indicated ordering of the variables. data need(keep = name code amount); set code(rename = (code1=code) ); output; code = code2; output; code = code3; output; run; 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_. > >data work.code; > input name:$8. (code1-code3)(:$3.) amount:comma8.; > format amount dollar8.0; > cards; >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!" .... Ok w/me! 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: http://www.sascommunity.org/wiki/V9.2_Phase_2_install_guide 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? Andre 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 ? > or > Something else needs to be done ? > > -- Andr� WIELKI INED (Institut National d'Etudes D�mographiques) Service Informatique 133 Boulevard Davout 75980 Paris Cedex 20 m�l : wielki@ined.fr 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! data visit1; set la11; if visitnum=1; lastresc1=lastresc; keep subjid lastresc1; run; data visit222; set la11; if visitnum=222; lastresc222=lastresc keep subjid lastresc222; run; data visit777; set la11; if visitnum=777; lastresc777=lastresc; keep subjid lastresc777; run; data new; merge visit1 visit222 visit777; by subjid; run; Proc Transpose could also be used on your first data set to flip it. -Mary ----- Original Message ----- From: Siddharth Jain To: Mary Sent: Wednesday, March 18, 2009 10:59 AM Subject: RE: Converting Macro Variable to a SAS Dataset Variable Hello Mary, 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. Thanks, Siddharth data la11; set la; if lacat in ('NTL') and subjid in ('101-001'); keep subjid visitnum lasitcd lastresc; run; proc sql; 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:mlhoward@avalon.net] Sent: Wednesday, March 18, 2009 11:54 AM To: Siddharth Jain; SAS-L@LISTSERV.UGA.EDU Subject: Re: Converting Macro Variable t...

Web resources about - Re: Ordering Variables in SAS Dataset #2 - comp.soft-sys.sas

Variable - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Westpac interest rate rise is one of many variable loan rate rises
WESTPAC is not alone in hitting its owner-occupier customers with a surprise interest rate rise, as dozens of other variable rate home loans ...

Airbnb upgrades variable pricing tool for hosts
Online home rental group Airbnb is rolling out an upgraded variable pricing tool that automatically raises or cuts room rates based on supply ...

Commonwealth Bank raises variable home loan rates
Home owners' mortgage costs are set to rise by hundreds of dollars a year, after the Commonwealth Bank became the latest bank to hike interest ...

CBA lifts variable home loan rates to offset costs associated with stricter capital requirements
The Commonwealth Bank to lift its home loan interest rates independently of the Reserve Bank to partially offset costs associated with stricter ...

Washington Square Signs Spielbergs, Choi Joins Variable and More
... films and an episode of the HBO comedy series "Girls," on which he plays the role of Ray Ploshansky. New York-based creative collective Variable ...

Mozilla moves Firefox to variable release schedule
... schedule process "carefully" and learning "a lot" from it in the past years, Mozilla has announced that Firefox is now moving to a variable ...

"You have to ignore many variables to think women are paid less than men. California is happy to try." ...
Writes Sarah Ketterer in The Wall Street Journal in "The ‘Wage Gap’ Myth That Won’t Die" (which you can get to without subscribing if you Google ...

Staley: 'A lot of different variables...been a hard year'
... 41° Navigation Home Giants A's Sharks Warriors Kings 49ers Raiders Quakes Insiders More Tickets Shop Watch Staley: 'A lot of different variables...been ...

When your environment variables are showing
There are embarrassing moments in life. There is the teacher calling you out as a child in class as you stare out the window wistfully imagining ...

Resources last updated: 3/17/2016 9:47:45 AM