LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (July 2007, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 2 Jul 2007 11:55:24 -0500
Reply-To:   SAS_learner <proccontents@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   SAS_learner <proccontents@GMAIL.COM>
Subject:   Re: Operating system , data _null_ questions ??
Comments:   To: saavri.gadkar@gmail.com
In-Reply-To:   <1183394287.099485.291340@x35g2000prf.googlegroups.com>
Content-Type:   text/plain; charset=ISO-8859-1; format=flowed

Sorry for making it so Long , I thought of it myself, I will make it into small question and make it more explict later some time

On 7/2/07, saavri.gadkar@gmail.com <saavri.gadkar@gmail.com> wrote: > > On Jul 1, 12:15 am, procconte...@GMAIL.COM (SAS_learner) wrote: > > Hello Guys, > > > > Sorry guys for a very Long email Please bare with me as I am too many > > questions ?? > > > > I have seen this piece of code when on the sas9 -----> Help -------> > > Learning SAS programming, When you say yes I think sas runs some code > and > > only thing you see is "Sample data sets and files are ready." in the Log > > Accidentally when I pressed F4 the following code appeared in the > Editor. > > > > Well here I have lot of questions like how can you can customize one > of > > the menu Items to run a program and do not so show the code in both in > the > > editor or Log ( I think in the Log they did by using %let > > repl=%sysfunc(getoption(replace,keyword));options replace; , My next > search > > to Google what does Options Replace does ) > > > > Second thing First Piece of code I think Author is telling SAS to > look > > for what kind of Operating system it is ran on right ??, Here I am > thinking > > that if SAS can recognize what is Operating system can we use similar > this > > piece of code and define Libnames ( The reason why I am asking is this > at > > the Place I work for the DM work we submit Jobs on OpenVms and for stat > > work we use Batch (windows ) submit and we change the libnames structure > > for submitting the Jobs ) What is difference of using on different > Operating > > System ?? > > > > And in the second and third piece of code they used to data _null_ > both to > > create a dataset and program and put out to folder ? what is possible > > advantage of this method ? I could see that they have used those > programs > > and datasets in the array statements but I did not understand the > authors > > purpose why he did that way . This seems to great way of writing > programs > > and calling them when needed, can you explain more of how to do and what > are > > things I need to keep in mind ?? > > > > Can you explain of what does this following code does ?? > > > > 1) rc=libname("act",trim(pathname("sasuser"))); > > > > What rc ( I think it stands for record code ) what is use of writng > somthing > > like this can somebody tell me what does above statment does ?? > > > > 2 ) This is some thing I did not quite Understand ?? > > > > array filelst2{21} $ filedt1-filedt21 ('aug99dat', > 'bookdata','cardata', > > 'choldata','excdata1', 'excdata2','excdata3','invent1','invent2', > > 'jan98dat','orderdat','personel','powerdat', > 'pubdata','saledata', > > 'satdata1','satdata2', 'survey1','tests','tests2','vandata'); > > do i=1 to dim(filelst2); > > if (host="CMS") then fileset=trim(filelst2(i)) || " data *"; > > else fileset=trim(filepath) || dlm || trim(filelst2(i)) || > ".dat"; > > isfile=fileexist(fileset); > > if isfile=1 then fileopts=trim(fileyes); > > else fileopts=trim(fileno); > > rc=filename(filelst2(i),fileset,"",fileopts); > > end; > > > > ****************************************Origonal Piece of > > Code************************************************; > > > > /* create sample data and assign librefs and filerefs */ > > > > %let repl=%sysfunc(getoption(replace,keyword)); > > options replace; > > > > data _null_; > > > > /* set librefs pointing to sasuser */ > > > > rc=libname("act",trim(pathname("sasuser"))); > > rc=libname("clinic",trim(pathname("sasuser"))); > > rc=libname("finance",trim(pathname("sasuser"))); > > rc=libname("flights",trim(pathname("sasuser"))); > > rc=libname("hrd",trim(pathname("sasuser"))); > > rc=libname("library",trim(pathname("sasuser"))); > > rc=libname("nov",trim(pathname("sasuser"))); > > rc=libname("parts",trim(pathname("sasuser"))); > > rc=libname("perm",trim(pathname("sasuser"))); > > rc=libname("theater",trim(pathname("sasuser"))); > > > > /* determine paths, delimiters, file options */ > > > > length fileno fileyes $18 fileset $ 1024; > > > > oshost=trim(substr(symget('sysscp'),1,2)); > > filepath=trim(pathname("sasuser")); > > if (oshost = "OS") and (length(symget('sysscp'))=2) then > > do; > > filepath=scan(filepath,1); > > dlm="."; > > fileno="disp=(new,catlg)"; > > fileyes="disp=(old,catlg)"; > > end; > > else do; > > host=trim(substr(symget('sysscp'),1,3)); > > if (host in ('WIN','OS2')) then > > do; > > filepath=trim(pathname("sasuser")); > > dlm="\"; > > fileno=""; > > fileyes=""; > > end; > > else if (host = "VMS") then > > do; > > filepath=""; > > dlm=""; > > fileno=""; > > fileyes=""; > > end; > > else > > do; > > filepath=trim(pathname("sasuser")); > > dlm="/"; > > fileno=""; > > fileyes=""; > > end; > > end; > > > > array filelst1{8} $ filesas1-filesas8 ('accnt','accnt01','accnt02', > > 'accnt03', > > 'accnt04','activity','fee', > > 'printfee'); > > do i=1 to dim(filelst1); > > if (host = "CMS") then fileset=trim(filelst1(i)) || " sas *"; > > else fileset=trim(filepath) || dlm || trim(filelst1(i)) || > ".sas"; > > isfile=fileexist(fileset); > > if isfile=1 then fileopts=trim(fileyes); > > else fileopts=trim(fileno); > > rc=filename(filelst1(i),fileset,"",fileopts); > > end; > > > > array filelst2{21} $ filedt1-filedt21 ('aug99dat', > > 'bookdata','cardata', 'choldata','excdata1', > > 'excdata2','excdata3','invent1','invent2', > > 'jan98dat','orderdat','personel','powerdat', > > 'pubdata','saledata', 'satdata1','satdata2', > > 'survey1','tests','tests2','vandata'); > > do i=1 to dim(filelst2); > > if (host="CMS") then fileset=trim(filelst2(i)) || " data *"; > > else fileset=trim(filepath) || dlm || trim(filelst2(i)) || > ".dat"; > > isfile=fileexist(fileset); > > if isfile=1 then fileopts=trim(fileyes); > > else fileopts=trim(fileno); > > rc=filename(filelst2(i),fileset,"",fileopts); > > end; > > run; > > > > /* create SAS programs*/ > > > > data _null_; > > infile cards4 missover length=l; > > length text $ 50; > > input text $varying50. l; > > file accnt03; > > put text; > > datalines4; > > data work.reliable; > > set clini.insure; > > where company='FRED SMYTHE; > > run; > > proc print data=work.reliable > > var id name company total balancedue; > > run; > > ;;;; > > run; > > > > data _null_; > > infile cards missover length=l; > > length text $ 50; > > input text $varying50. l; > > file aug99dat pad lrecl=80; > > put text; > > datalines; > > 100 02AUG99 R 6 30.00 180.00 > > 103 03AUG99 C 20 3.99 79.80 > > 102 04AUG99 T 4 200.00 800.00 > > 103 08AUG99 T 5 200.00 1000.00 > > 102 09AUG99 R 15 30.00 450.00 > > 101 10AUG99 C 100 3.99 399.00 > > 101 12AUG99 R 18 30.00 540.00 > > 104 15AUG99 T 10 200.00 2000.00 > > 103 18AUG99 C 9 3.99 35.91 > > 100 22AUG99 T 3 200.00 600.00 > > 102 23AUG99 R 10 30.00 300.00 > > 100 25AUG99 C 100 3.99 399.00 > > 101 30AUG99 T 3 200.00 600.00 > > ; > > run; > > I think if you are a begineer then you need to go slow and instead of > learning from sas help. Pick up some good book like little sas book or > sas language ref manual which is freely downloadable at the > support.sas.com > Your above request is too ambitious, and i almost slept reading just > half of your doubt list. >


Back to: Top of message | Previous page | Main SAS-L page