Thursday, March 6, 2014

Tuesday, May 7, 2013

Awesome Conference SAS® Global Forum 2013 :)

August 28, 2012 Call For Papers Opens
November 5, 2012 Online Registration Opens
November 19, 2012 Call For Papers Closes
January 14, 2013 Acceptance Of Contributed Papers
February 4, 2013 Signed Copyright Grant Or CG Delay Form Due At SAS
February 6, 2013 Section Chair To Be Notified Of Any Special Equipment Needs
February 14, 2013 Conference Schedule And Abstracts Available On The Web
March 14, 2013 PDF of Final Paper Must Be Uploaded In the Call for Papers System
March 25, 2013 Early Registration Ends
April 17, 2013 Paper Presenters To Email Their Presentation To Section Chair For Pre-Loading To Section Laptop
April 22, 2013 Last Day For Pre-Registration Or Cancellation
April 27, 2013 On-Site Registration Opens
April 28, 2013 SAS Global Forum 2013 Begins!

http://support.sas.com/resources/papers/proceedings13/418-2013.pdf

Tuesday, March 19, 2013

ERROR: Unable to clear or re-assign the library

A code which was trying to assign the path of existing library to SASUSER library throws an error as below in SAS 9.2.

1283  +LIBNAME sasuser "/apps/sas/abc";*path of existing library is assigned to sasuser;
ERROR: Unable to clear or re-assign the library SASUSER because it is still in use.
ERROR: Error in the LIBNAME statement.


Below code is used to circumvent this problem

1660   ods path reset;
1661   libname sasuser clear;
NOTE: Libref SASUSER has been deassigned.
1662   LIBNAME sasuser "/apps/sas/abc";*path of existing library is assigned to sasuser;
NOTE: Libname SASUSER refers to the same physical library as ABC.

Wednesday, December 19, 2012

Monday, December 10, 2012

My 100th Post (macro variables created in a single list)

proc sql noprint;

create table test as select distinct
unq_catg_desc,
quote(strip(unq_catg_desc)),
"'"|| (strip(unq_catg_desc)) ||"'",
unq_catg_i,
unq_catg_i format 8. as var
from abc.unq_hr;

select * into
:E1 SEPERATED BY " , " ,
:E2 SEPERATED BY " , " ,
:E3 SEPERATED BY " , " ,
:M1 SEPERATED BY " " ,
:M2 SEPERATED BY " , "
from test;

quit;
%PUT &E1; %PUT &E2; %PUT &E3;
%PUT &M1; %PUT &M2;

Apple , Custard Apple ,
"Apple" , "Custard Apple" ,
'Apple' , 'Custard Apple' ,
29 25
29 , 25 ,

More: http://www2.sas.com/proceedings/sugi27/p071-27.pdf

Sunday, December 9, 2012

Registering a table in SAS Metadata Server

For creating a dynamic prompt in stored process/ EG, a SAS user should register his/her table (i.e., the respective source for prompt). For registering the table in SAS Metadata Server, one can make use of the METALIB procedure.

proc metalib;
omr (library="abc");
select("MSTR");
/* Create a summary report of the metadata changes. */
report;
run;

More: http://support.sas.com/documentation/cdl/en/engimap/61078/HTML/default/viewer.htm#a003088532.htm

ERROR: Template 'MyTemplate' was unable to write to template store!

While creating graphs, I made use of below code to avoid this error-

ODS PATH work.templat(update) sasuser.templat(read) sashelp.tmplmst(read);

More: http://www.runsubmit.com/questions/179/error-with-ods-and-proc-template

Play with Graphs


http://support.sas.com/sassamples/graphgallery/index.html
http://robslink.com/SAS/Home.htm

Wednesday, September 12, 2012

System.InvalidOperationException - SplitterDistance must be between Panel1MinSize and Width - Panel2MinSize

Incase if you receive the below error –

1. Navigate to path “H:\Personal\Appdata\SAS\EnterpriseGuide\4.3”
2. And delete 4.3 folder













More: http://support.sas.com/kb/43/655.html

Tuesday, June 12, 2012

Order of precedence

The below merge is more like a set statement. But here there is a possibility of the same store occurring in both new_stores and mature_stores table. Hence flagging with ‘if a’ and ‘if b’ could be problem, as one store could fall in both the groups. Care should be taken while making use of this logic. In the below example if a store is found in mature_stores table then it no more belongs to new store category, so the order of precedence is given to mature stores using ‘if a’.


/* Dataset for MATURE & NEW STORE*/
data all_stores;
merge mature_stores(in=a) new_stores(in=b);
by str_i;
if a then FLAG="Mature";
if b then FLAG="New";
run;

Datalines within a macro will throw error

*Datalines outside a macro;
data new1;
input x 8.;
datalines;
1
2
3
;
run;

%macro test2;
*Datalines within a macro will throw error;
data new2;
input x 8.;
datalines;
1
2
3
;
run;
%mend test2;
%test2;

*ERROR: The macro TEST2 generated CARDS (data lines) for the DATA step, which could cause incorrect results. The DATA step and the macro will stop executing.;

%macro test3;
*Make use of the below method if you want to create records;
data new3;
length x 8.;
x=1; output;
x=2; output;
x=3; output;
run;
%mend test3;
%test3;

Else one can make use of proc sql insert into

Execute macro with data _null_

options mprint mlogic symbolgen;


*Create a dataset with no records;
data test_store;
attrib store length=8 ;
attrib go_d length=8 format=date9.;
stop;
run;


*This macro gets executed by call execute to populate test_store - with no observation;
%macro store(str_i);
proc sql noprint;
insert into test_store
select &str_i, go_d from def.str
where str_i = &str_i;
quit;
%mend store;


*Pick random sample of stores for which the test_store dataset should get populated;
data random;
set abc.score_11;
x=ranuni(1234);
run;


*Randomly sort the data set;
proc sort data=random;
by x;
run;


*Keep the first n observations. Since the data points are randomly sorted, these observations constitute a simple random sample;
data sample(drop=x);
set random (obs=10);
run;


*This creates a dataset named test_store WITH ONLY THOSE STORES THAT ARE PRESENT IN SAMPLE;
data _null_;
set sample;
call execute('%store('str_i')');
run;


More: http://www2.sas.com/proceedings/sugi22/CODERS/PAPER86.PDF