comp.soft-sys.sas - The SAS statistics package.
Hello Everyone! I want to change the directory of the work folder from the default directory (/usr/tmp/SAS_workB91900004B5A_Evs01Sas03) to a new one. Is it possible in SAS9.1.3. We work on SAS using the linux server platform. Regards, Ankur Shanker ________________________________ The information in this e-mail is the property of Evalueserve and is confidential and privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and will be unlawful. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
I thought there was an easy way to determine the libref for "work" data sets (i.e. those that can be accessed via a one level name), but I could not find anything on SAS-L or in the on-line doc. Of course, searching for WORK USER LIBREF can provide a number of non-related hits (see additonal slightly off topic question at bottom). I ended up writing the code included below to determine the libname and memname for one level data set names. (I need the two level name to extract info from the dictionary tables) Is there an easier way to figure out the two level name? ============================================================= %*** get lib & mem; %macro libmem(in=,lib=_lib,mem=_mem); %if %scan(&in,2,.)>' ' %then %do; %*** two level names are easy; %let &lib=%scan(&in,1,.); %let &mem=%scan(&in,2,.); %end; %else %do; %*** one level names are more challenging; %*** if USER option is set, then use it; %let &lib=%sysfunc(getoption(USER)); %if "&&&lib"="" %then %do; %*** if no USER option, check USER libref, if there use it; proc sql noprint; select distinct libname into :&lib from DICTIONARY.MEMBERS where libname='USER'; quit; %*** if no USER libref defined then it must be WORK; %if "&&&lib"="" %then %let &lib=WORK; %end; %let &mem=∈ %end; %*** upcase for use with dictionary tables; %let &lib=%upcase(&&&lib); %let &mem=%upcase(&&&mem); %put &lib is &&&lib &mem is &&&mem; %mend; %libmem(in=sashelp.prdsale); data prdsale; set sashelp.prdsale(obs=1); run; %libmem(in=prdsale); libname USER 'c:\DeleteThisFolder'; data prdsalU; set sashelp.prdsale(obs=1); run; %libmem(in=prdsalU); libname altUser 'c:\DeleteThisOneToo'; options user=altUser; data prdsalO; set sashelp.prdsale(obs=1); run; %libmem(in=prdsalO); ============================================================= While looking at the on-line doc I found these: Files in UNIX System Services can also be specified without a libref. The following example specifies an HFS file using a relative path: data 'saswork/two'; x=2; run; I do not currently have access to a UNIX or OS/390 box, but was wondering, do data sets accessed in this way show up in the dictionary tables? And, if so, what do they look like? Just curious. No real need to know. Thanks for any assistance or advice, Tammie
Hi, FIRST. and LAST. come in very handy when you want to identify the first of a value group or the last of a value group. For example, you have a BY statement with DATE. When a BY statement is used with your SET statement you will have the first.date and last.date flags set depending upon each of the distinct sets of unique values found in the DATE variable. If I am not mistaken, you are asking for the first observation, not the first of every group of values. There are two way that come to mind. You could: data d8; set d7; by date; retain cash; if _N_ eq 1 then cash = 0; else cash=cash+tot_Div+tot_purchase+tot_sales; run; However, most of us use the default value argument to the RETAIN statement: data d8; set d7; by date; retain cash 0; cash=cash+tot_Div+tot_purchase+tot_sales; run; Hope this is helpful. Mark Terjeson Senior Programmer Analyst, IM&R Russell Investment Group Russell Global Leaders in Multi-Manager Investing -----Original Message----- From: SAS(r) Discussion [mailto: XXXX@XXXXX.COM ] On Behalf Of Airungao Sent: Thursday, July 21, 2005 2:15 PM To: XXXX@XXXXX.COM Subject: How do detect that I am processing the first of nth observation? Dear all, I am writing the first SAS program in my life. I am sure many of you can give me a quick answer pretty fast. Thanks in advance. data d8; set d7; by date; retain cash; if first.obs then <- HERE IS WHERE I NEED THE HELP, if I am at the first obs, I need to set cash to 0 cash = 0; else cash=cash+tot_Div+tot_purchase+tot_sales; run;
Dear all, I have a list of names which I am trying to assign unique IDs to the same person. However the names are pretty messy. Thus, I matched the list of names to itself and am able to come up with a set of possible matches for each name. The below is a part of my resulting dataset after having matched the list of names with itself: Obs NAME MatchingName 1 ADERHOLD, A ADERHOLD, AB 2 ADERHOLD, A ANDERHOLD, A 3 ADERHOLD, AB ADERHOLD, A 4 ANDERHOLD, A ADERHOLD, A 5 KLINEFELLER KLINEFELTER 6 KLINEFELLER KLINEFELER 7 KLINEFELTER KLINEFELLER 8 KLINEFELTER KLINEFELER 9 KLINEFELER KLINEFELTER 10 NDERHOLD, A ANDERHOLD, A I would like to assign observation 1, 2, 3, 4, and 10 to one ID and 5,6,7,8,9 to another ID. I am not able to figure out how to do so, since the matching is not symmetrical. Any help would be much appreciated. Thank you and have a good weekend! Regards, Angie