%macro RemoveDir(dir); options noxwait; /* Option noxwait specifies that the command processor automatically returns to the SAS session after the specified command is executed. You do not have to type EXIT... */
%local rc fileref ; %let rc = %sysfunc(filename(fileref,&dir)) ; /* This sysfunc and the filename statements check for the existence of the directory */ %if %sysfunc(fexist(&fileref)) %then %do; %put Removing directory &dir....; %sysexec rmdir /Q /S "&dir" ; /* Options /Q for quiet mode with no prompting and /S for removing sub directories */ %if &sysrc eq 0 %then %put The directory &dir and its sub-directories have been Deleted. ; %else %put There was a problem while Removing the directory &dir; %end; %else %put The directory &dir does NOT EXIST; %mend RemoveDir
Hi, I have a very basic question regarding user defined formats, I have formats in a file and I want to read that in a SAS DI job and then use it in an expression. Can you please give me the steps for it. Thanks, Ashish
Specify a Format Library in a Preprocess to a Job SAS Data Integration Studio users can specify the location of the format library in a preprocess to a job. The preprocess would consist of SAS statements such as the following: Options fmtsearch=(myformat library work); libname myformat "C:\formats\myformats"; The SAS Application Server that executes the job must be able to resolve the path that you specify in the LIBNAME statement for the format library. The following steps describe one way to specify a format library in a preprocess to a job: 1. From the SAS Data Integration Studio desktop, select the job you want to update, then select Edit ð Properties from the menu bar. The property window for the job displays. 2. Click the Precode and Postcode tab, and then select the Precode check box. 3. In the code panel, enter a FMTSEARCH option and a LIBNAME statement that are similar to the previous example code. 4. To save the precode in metadata, click OK. To save the precode to a file, click Save As, specify a server and filename for the code, and then click OK. When you execute the job, the preprocess code runs first and the specified format library becomes available when the rest of the job executes.
hi nitin ,i'm preparing for SAS DI STUDIO cetification.Do you have any material to prepare for certification.I have only user guide. Please let me know how to prepare...any books,suggestions,blogs....Could you please send material to purnaganti@gmail.com
I would prefer you to do practice on SAS DI studio because most of the question comes from transformation property. Practice in DI studio will help you a lot rather than reading books.
Sorry , but I don't have enough content for SAS BI certification but BI and DI certification exam pattern is almost same.As I did the SAS DI certification I will suggest you to do more practice on SAS BI tools because in exam you will find the question from SAS all BI tools (Properties , option , wizard)
Q : can the output file be open only in text editor or excel or both ?
2) data test; test abc; if x < 10 then x=1; else if x < 20 then x = 2; else x = 3 ; run; Q : what is the value of x if x initially had a missing value
3) data test ; set abc ; retain city = 'somebigcityname'; state = 'somebigstatename'; run;
Q : waht is true i) both retain and assign statement are different way of assigning value and are as effective ii) retain assigns onces and assign statement assings value of state 5 times ... ii) retain statement will cause truncation because length is not set, so default of 8 length will be created.
I have completed my Advance SAS certification recently. Since I had few years of SAS platform Admin experience in the past I am now planning to take SAS Platform Admin certification soon.
But unfortunately I am not able to find too much of the ppl discussing over blogs on this particular certification.
If you could let me know the best training materials for this and some latest questions if you have, it will be very useful.
Hi Nitin, I am preparing for Advance SAS certification and m done with preparation guide and dumps available on various sites (including this). is it sufficient? As i have read in some comments here that they have now changed the pattern. any idea on this.
Hi , my qs is let's say one variable i.e. ID has values like 1,4,6,10,13,45,101,103,132,145 and i want to put a leading zero for the values which are less than 10, how to do it? thanks in Advance
It's depends which parameter are you passing in scan function else it will take a list of special characters as a parameter like ':) /-_# and will give the result according
How to remove directory by SAS prog
ReplyDelete/* Macro to Remove a PC directory */
Delete%macro RemoveDir(dir);
options noxwait; /* Option noxwait specifies that the command processor automatically returns to the SAS session
after the specified command is executed. You do not have to type EXIT... */
%local rc fileref ;
%let rc = %sysfunc(filename(fileref,&dir)) ; /* This sysfunc and the filename statements check for the existence of the directory */
%if %sysfunc(fexist(&fileref)) %then
%do;
%put Removing directory &dir....;
%sysexec rmdir /Q /S "&dir" ; /* Options /Q for quiet mode with no prompting and /S for removing sub directories */
%if &sysrc eq 0 %then
%put The directory &dir and its sub-directories have been Deleted. ;
%else
%put There was a problem while Removing the directory &dir;
%end;
%else %put The directory &dir does NOT EXIST;
%mend RemoveDir
I will update the ans soon.
ReplyDeleteHi I would need some training on SAS Advance. Can you pls contact me in +91 9884944799 or share your details
ReplyDeleteSure you can contact me on 9015943944
ReplyDeleteHow to find number of variable in dataset using data step?
ReplyDeleteTry This.
Deletedata nn ;
set sashelp.class nobs=a;
new =a;
keep new;
run ;
proc print ; run ;
data nn;
Deleteset your.dataset;
run;
check log, you will see number of observations and variables.
I think this is the best way of counting number of variables
ReplyDelete%let nvar=%sysfunc(attrn(%sysfunc(open(lib.datasetname,i)),nvars));
%put &nvar;
Hi,
ReplyDeleteI have a very basic question regarding user defined formats, I have formats in a file and I want to read that in a SAS DI job and then use it in an expression.
Can you please give me the steps for it.
Thanks,
Ashish
Hi Ashish ,
DeleteYou can try these steps.
Specify a Format Library in a Preprocess to a Job
SAS Data Integration Studio users can specify the location of the format library in a
preprocess to a job. The preprocess would consist of SAS statements such as the following:
Options fmtsearch=(myformat library work);
libname myformat "C:\formats\myformats";
The SAS Application Server that executes the job must be able to resolve the path that you
specify in the LIBNAME statement for the format library.
The following steps describe one way to specify a format library in a preprocess to a job:
1. From the SAS Data Integration Studio desktop, select the job you want to update, then
select Edit ð Properties from the menu bar. The property window for the job displays.
2. Click the Precode and Postcode tab, and then select the Precode check box.
3. In the code panel, enter a FMTSEARCH option and a LIBNAME statement that are
similar to the previous example code.
4. To save the precode in metadata, click OK. To save the precode to a file, click Save
As, specify a server and filename for the code, and then click OK.
When you execute the job, the preprocess code runs first and the specified format library
becomes available when the rest of the job executes.
Hope I answered your question
Thanks ,
Nitin Kumar
hi nitin ,i'm preparing for SAS DI STUDIO cetification.Do you have any material to prepare for certification.I have only user guide.
ReplyDeletePlease let me know how to prepare...any books,suggestions,blogs....Could you please send material to purnaganti@gmail.com
HI Purna ,
DeleteThanks for visiting my blog.
I would prefer you to do practice on SAS DI studio because most of the question comes from transformation property.
Practice in DI studio will help you a lot rather than reading books.
All the best for your exam.
Thanks Nitin
Hello i am new to SAS could you suggest me where can i get the basic SAS Software for learning SAS
ReplyDeleteHello Durga ,
DeleteThanks for visiting my blog.
You can find the link below for free Educational SAS software.
Thanks
Nitin Kumar
http://sastrick.blogspot.in/2014/05/free-official-sas-software-for-students.html
DeleteHi Nitin,
ReplyDeleteI am planning to give SAS BI content developer certification. Could you please let me know how to prepare...any books,suggestions,blogs etc.
Thanks in advance.
Thanks & Regards,
Abhishek
Hi Abhi ,
DeleteSorry , but I don't have enough content for SAS BI certification but BI and DI certification exam pattern is almost same.As I did the SAS DI certification I will suggest you to do more practice on SAS BI tools because in exam you will find the question from SAS all BI tools (Properties , option , wizard)
Thanks
Nitin
Thanks Nitin
DeleteHi Nitin,
ReplyDeleteI want to do SAS certification, but i dont have sas software. So what to do?
Practice recquired?
Some tricky questions i came across today -
ReplyDelete1) ods csvall body='c:\test\csvall.csv';
proc print data=test;
by sex;
run;
ods csvall close;
Q : can the output file be open only in text editor or excel or both ?
2)
data test;
test abc;
if x < 10 then x=1;
else if x < 20 then x = 2;
else x = 3 ;
run;
Q : what is the value of x if x initially had a missing value
3)
data test ;
set abc ;
retain city = 'somebigcityname';
state = 'somebigstatename';
run;
Q : waht is true
i) both retain and assign statement are different way of assigning value and are as effective
ii) retain assigns onces and assign statement assings value of state 5 times ...
ii) retain statement will cause truncation because length is not set, so default of 8 length will be created.
Hi Nithin,
ReplyDeleteHope you are doing good!
I have completed my Advance SAS certification recently. Since I had few years of SAS platform Admin experience in the past I am now planning to take SAS Platform Admin certification soon.
But unfortunately I am not able to find too much of the ppl discussing over blogs on this particular certification.
If you could let me know the best training materials for this and some latest questions if you have, it will be very useful.
Thank you.
Regards,
Ram
Hello Ram ,
DeleteThanks for visiting my blog.Regarding SAS Admin I really do not have any good study material , but If I will find something I will forward to you.
Regards,
Nitin
Anyone have dumps for A00-211????
ReplyDeleteANY QUESTIONS FOR SAS SBA.
ReplyDeleteSorry Friend don't have any material for SAS SBA, If I will find something I will post on my blog.
DeleteThanks for visiting the blog.
Thanks ,
Nitin Kumar
Hi Nitin, I am preparing for Advance SAS certification and m done with preparation guide and dumps available on various sites (including this). is it sufficient? As i have read in some comments here that they have now changed the pattern. any idea on this.
ReplyDeleteHello ,
DeleteThanks for positing your question.
It is true that question has been changed , now there are some question like more than 2 correct ans and in some of the ques you have to type the ans.
If you are preparing for the advance SAS , give more time to programming efficiency technique.
Hope I answered your ques
Thanks ,
Nitin
Hi , my qs is let's say one variable i.e. ID has values like 1,4,6,10,13,45,101,103,132,145 and i want to put a leading zero for the values which are less than 10, how to do it?
ReplyDeletethanks in Advance
Hi Prasant ,
DeleteThanks for visiting my blog.
If I correctly understood your question below the code you can try.
data aa ;
input id $;
if id <10 then id = cat('0',id);
datalines ;
1
2
4
7
12
56
9
2
;
run ;
Thanks ,
Nitin Kumar
but here in this data step we need to convert character to numeric and than apply if condition...
DeleteAbove code will do automatic conversion.
ReplyDeletePlease run the code and let me know if you have still some doubts.
Nitin
Usually how scan function separates the character words from character expression??
ReplyDeleteIt's depends which parameter are you passing in scan function else it will take a list of special characters as a parameter like ':) /-_# and will give the result according
DeleteHi
ReplyDeleteI was wondering is it enough to prepared Advanced SAS Certification in your blog
Unfortunately I haven't covered all the topic but my post will definitely help you a lot to prepare for Advance certification
DeleteThanks,
Nitin Kumar
How to replicate DDE functionality using UNIX SAS?
ReplyDeleteSorry , I haven't tried this.
Delete