f



Re: How to call another program within a program in SAS???

oseithedude@GMAIL.COM wrote:
>Hey, I have a SAS program that, among other things, creates a dataset
>containing "bad" observations that I have no use for. There are about
>2,000 of these "bad" observations in the data set but there may be
>10-15 "good" observations that I want to keep in the dataset. There is
>a variable in the data set called "line" and each observation has a
>different "line" number. I have 2,000 "line" numbers that I have thrown
>into a if... not in statement that can delete all of the 2000 "bad"
>observations as follows:
>
>data program;
>set original;
>if line not in ('1','456','767',etc..[2,000 numbers within this
>statement].);
>run;
>
>I don't want to put the program above within the "main" program that
>created the original dataset (because I don't want all 2,000 numbers
>within that main program), but I do want to be able to call the program
>above from the main program and have the original dataset be returned
>minus the 2,000 observations with "bad" line numbers. Is it possible to
>call another program within a program
>like this??? Thanks in advance...

I don't think that having 2000 entries in an IN statement is a good way to
handle your problem.  I agree with Richard.  Keeping them in a different
data
set is a good way to make your system more maintainable, and easier to use
in another program.

In addition to Richard's idea, you could also consider putting your list in
a SAS
format.  SAS will let you build formats from data sets (look at the CNTLIN
feature
of PROC FORMAT for more detail), and then you could call up your format
easily.

Also, is your variable LINE character or numeric?  You have it set up for a
character variable in the IN statement, since you are testing it against
quoted
strings.  If LINE is numeric, then you ought to drop all those quote marks
too.

HTH,
David
--
David L. Cassell
mathematical statistician
Design Pathways
3115 NW Norwood Pl.
Corvallis OR 97330

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
0
davidlcassell (5567)
10/27/2005 6:36:33 AM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

0 Replies
515 Views

Similar Articles

[PageSpeed] 5

Reply:

Similar Artilces:

Re: Can a SAS program call another SAS program
> From: David Fickbohm > I am writing a report that counts the number of widgets produced by > partners. I have a small routine that finds the partners id > number and > name. Obviously I could copy this code into my program and > execute it. I was wondering if there was a more elegant way > of "Calling" a SAS program > from within a SAS program. > I am running SAS 8.1 in windows. still!?!? surely that is a typo: 9.1? i.e.: -The- 9.1==9.1.3 include it: - - - subRoutineX.sas - - - *...; - - - subRoutineX.sas end - - - - - - autoexec.sas - - - filen...

Re: Can a SAS program call another SAS program #4
> From: Michael Raithel > David Fickbohm posted the following: > > I am writing a report that counts the number of widgets produced by > > partners. I have a small routine that finds the partners id > > number and > > name. Obviously I could copy this code into my program and execute > > it. I was wondering if there was a more elegant way of "Calling" a > > SAS program > > from within a SAS program. I am running SAS 8.1 in windows. > > > > David, there sure is a more elegant way; and a simple one at > that! Simply ...

Re: Can a SAS program call another SAS program #3
Dear SAS-L-ers, David Fickbohm posted the following: > I am writing a report that counts the number of widgets produced by > partners. I have a small routine that finds the partners id > number and > name. Obviously I could copy this code into my program and > execute it. I was wondering if there was a more elegant way > of "Calling" a SAS program > from within a SAS program. I am running SAS 8.1 in windows. > David, there sure is a more elegant way; and a simple one at that! Simply use the %INCLUDE statement. The %INCLUDE statement allows you to in...

Re: Possible to run a SAS program within another SAS program?
Julie, Uhhh create a macro that simply %includes the programs you want and in what order. It would be very specific to you the creator and user, in other words right biw I can't think of a good way to pass al the info you need to the macro from the user. As you can tell the user interface would be the crucial part of this. I personally wouldnt want to have this in my production code but have written SAS programs that do nothing more than %include a list of programs. Toby Dunn From: oseithedude@GMAIL.COM Reply-To: oseithedude@GMAIL.COM To: SAS-L@LISTSERV.UGA.EDU Subject: Possibl...

Re: Can a SAS program call another SAS program #2
Dave, What you want to do can be done with %include. Bob Abelson HGSI 240 314 4400 x1374 bob_abelson@hgsi.com David Fickbohm <DavidF@HOMEGAIN.COM> Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> 10/15/2004 04:05 PM Please respond to David Fickbohm To: SAS-L@LISTSERV.UGA.EDU cc: Subject: Can a SAS program call another SAS program People, I am writing a report that counts the number of widgets produced by partners. I have a small routine that finds the partners id number and name. Obviously I could copy this code into my...

Re: Possible to run a SAS program within another SAS program? #6
On Wed, 7 Dec 2005 22:32:49 -0800, oseithedude@GMAIL.COM wrote: >nevin.krishna@gmail.com wrote: >> You could use the %include statement to call a specified program. >> for example : >> >> %include "c:\documents and settings\nkrishna\my >> documents\macros\upcase_mac.sas"; >> >> where upcase_mac.sas is a program stored in the above path..so you >> could write an include statement for each program and then copy and >> paste them into any order you need..unless of course i am >> misunderstanding your needs..:-) >> >...

Re: Possible to run a SAS program within another SAS program? #2
Dear SAS-L-ers, Julie posted the following: > Hello, I have 9 SAS programs, all within the same Windows > folder that I usually run at the same time - one right after > the other. For convenience, is it possible to write a simple > SAS program that will let me run all the programs at once or > to have a program that will allow me to pick and choose which > SAS programs I want to run (e.g., in the case I only want to > run the first 3 and last program out of the 9 SAS > programs) and which order the programs are run in? I guess > what I'm really looking for is i...

Re: Possible to run a SAS program within another SAS program? #4
Julie, Simple answer. Store programs in one directory, say C:\sasprogs. filename pgm "c:\sasprogs" ; %inc pgm (prog1, prog3, ... ) ; Ian Whitlock =============== Date: Wed, 7 Dec 2005 11:28:43 -0800 Reply-To: oseithedude@GMAIL.COM Sender: "SAS(r) Discussion" From: oseithedude@GMAIL.COM Organization: http://groups.google.com Subject: Possible to run a SAS program within another SAS program? Comments: To: sas-l Content-Type: text/plain; charset="iso-8859-1" Hello, I have 9 SAS programs, all within the same Windows folder th...

Re: Possible to run a SAS program within another SAS program? #3
why just last week, we discussed this: Date: Mon, 21 Nov 2005 11:01:30 -0500 Subject: Re: Running SAS programs from within a SAS program http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0511C&L=sas-l&P=R33664 Ron Fehd the %include maven CDC Atlanta GA USA RJF2 at cdc dot gov > -----Original Message----- > From: osei the dude > Hello, I have 9 SAS programs, all within the same Windows > folder that I > usually run at the same time - one right after the other. For > convenience, is it possible to write a simple SAS program > that will let > me run ...

Re: Possible to run a SAS program within another SAS program? #5
Subject: Re: Possible to run a SAS program within another SAS program? Summary: Simple introduction to macro and design issues in the context of multiple programs producing data with a version indicator Respondent: Ian Whitlock iw1junk@comcast.net Julie, It looks like you are ready to think about program design with a little macro. As you present it, the keys ideas are 1) set of multiply related programs sometimes run as a set and sometimes only a subset 2) some programs produce data set with version indicator Your basic set up indicates that you are thinking of each...

Re: Running a SAS program within a SAS program
%include() On Mon, Apr 21, 2008 at 12:55 PM, Kathleen Santos <flowerpotcat@gmail.com> wrote: > Hello, > > I would like to combine multi years of data into one. Each year has a > particular data set and a particular program to create a SAS dataset. > However, not all programs are the same (e.g. variable names may change > throughout the years). > > What I would like to do is to create one program that would call on the > other programs to create SAS datasets. Then I'll integrate them together and > do whatever I it is I need to do. > > I ...

Can a SAS program call another SAS program
People, I am writing a report that counts the number of widgets produced by partners. I have a small routine that finds the partners id number and name. Obviously I could copy this code into my program and execute it. I was wondering if there was a more elegant way of "Calling" a SAS program from within a SAS program. I am running SAS 8.1 in windows. Thanks Dave Dave Fickbohm Data Mining Analyst Homegain+ 2450 45th St. Emeryville, CA, 94608 Phone 510 655 0800 ext 4151 ...

Re: Running SAS programs from within a SAS program
Keith, You can use a series of %include statements naming the programs in the order you want to call them in. %include "drive:\your_folder\program name.txt" ; Mah-J M. Soobader, PhD Principal consultant STATWORKS www.statworks.com -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of Keith W. Larson Sent: Friday, November 18, 2005 10:32 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Running SAS programs from within a SAS program Dear All, I have several small(ish) SAS programs that convert and format DBF files. Thanks to all who helped solve...

How to call another program within a program in SAS???
Hey, I have a SAS program that, among other things, creates a dataset containing "bad" observations that I have no use for. There are about 2,000 of these "bad" observations in the data set but there may be 10-15 "good" observations that I want to keep in the dataset. There is a variable in the data set called "line" and each observation has a different "line" number. I have 2,000 "line" numbers that I have thrown into a if... not in statement that can delete all of the 2000 "bad" observations as follows: data program; set ...

Re: Reusing code from SAS Program in another SAS Program
Keith - Store your code snippets in a PDS and then %include into your programs. For example this program includes a format called "$REGCRT" that I've stored in the PDS DSCHEER.PROD.RUN.FORMATS($REGCRT): //LOOKUP JOB (DSDBX0000T,DS80,20,5,0),'CHOATE 654-2160',TIME=1, // USER=DSPAULC,MSGCLASS=X,NOTIFY=DSPAULC //GOSAS EXEC HWSAS //SYSIN DD * OPTIONS PS=2000 LS=80; LIBNAME VENDOR 'DS.SYS.WORK.VENDOR.PANEL' DISP=SHR; FILENAME FMT 'DSCHEER.PROD.RUN.FORMATS' DISP=SHR; %INC FMT($REGCRT); DATA LOOKUP; RETAIN SENDDATE VENDRC RCNA...

Re: Running a SAS program within a SAS program #3
Kathleen, You can use %INCLUDE in a SAS program to call other SAS programs. Jack Clark Research Analyst Center for Health Program Development and Management University of Maryland, Baltimore County -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Kathleen Santos Sent: Monday, April 21, 2008 12:55 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Running a SAS program within a SAS program Hello, I would like to combine multi years of data into one. Each year has a particular data set and a particular program to create a SAS dataset. However, not all programs are the same (e.g. variable names may change throughout the years). What I would like to do is to create one program that would call on the other programs to create SAS datasets. Then I'll integrate them together and do whatever I it is I need to do. I hope someone can help me. Thanks. Kathleen ...

Re: Running a SAS program within a SAS program #2
Kathleen Based on your subject, my immediate impulse was %inlude() where you put a fileref in the quotes. However, I think you want to do something else. You say that you have individual programs that produce a set for each year. Do you store these sets somewhere or do you run the programs when you want data for a given year. I would suggest that you first get a collection of these yearly sets and run a contents on each one. Then, write a program similar to Data mylib.combined; set mylib.year1(rename = (Dates = Date ....)) mylib.year2(rename= (Sdates=Date....)) ..... ; The idea would be to get rid of the variations in the variable names. You could simply copy in the individual programs into one honking big program and keep running this until you get a uniform combined set but you will use a lot of machine cycles doing this. Assuming that you have to make several passes at the data in order to get things right, I would work from stored data sets where all you are doing is changing the rename statements. Good luck Nat Wooding Environmental Specialist III Dominion, Environmental Biology 4111 Castlewood Rd Richmond, VA 23234 Phone:804-271-5313, Fax: 804-271-2977 Kathleen Santos <flowerpotcat@GMA IL.COM> To Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU Discussion" cc <SAS-...

Possible to run a SAS program within another SAS program?
Hello, I have 9 SAS programs, all within the same Windows folder that I usually run at the same time - one right after the other. For convenience, is it possible to write a simple SAS program that will let me run all the programs at once or to have a program that will allow me to pick and choose which SAS programs I want to run (e.g., in the case I only want to run the first 3 and last program out of the 9 SAS programs) and which order the programs are run in? I guess what I'm really looking for is if there is a way to call another SAS program using only a couple lines of code so that, if ...

Re: Running SAS programs from within a SAS program #2
Or better when programs are in one directory file code "drive:\your_folder\" ; %inc code ( prog1 prog2 prog3 ... ) ; Then the next step is parameter driven macros in an autocall library. %prog1(parm1=...) %prog2(alpha=...) ..... Ian Whitlock ================= Date: Fri, 18 Nov 2005 22:54:54 -0500 Reply-To: mah-j@statworks.com Sender: "SAS(r) Discussion" From: "mah-j@statworks.com" <msoobader@VERIZON.NET> Subject: Re: Running SAS programs from within a SAS program...

Re: Reusing code from SAS Program in another SAS Program #4
In response to a question by Keith, Paul Choate suggested using %INC. The suggestion is reasonable, but not his explanation. Since %INC is a macro you can put it anywhere in open code and it will read the code snippet during compilation. %INC is neither a macro nor a macro instruction. It is one of a few old SAS commands that begin with a %-sign and predate the current macro language. This can be shown by a batch job run with the option NOMACRO. Here is the log. NOTE: SAS (r) Proprietary Software Release 8.2 (TS2M0) Licensed to The SAS Learning Edition V2.0, Site ...

Re: Reusing code from SAS Program in another SAS Program #5
Ian, I agree with your statement: "Well maybe it is best postponed to the time Keith shows that parameterization would be helpful to him." If it does turn out that parameterization would be helpful to him, he is in luck. I will agree to offer him, and SAS-L, the best example that my understanding of the SAS Component Language and my meager skills will allow. And I hope you, and as many other mmmm's as possible, will do likewise with the SAS Macro Language. I hope it has become apparent to you and other mmmm's that the SAS Component Language can handle whole classes of pr...

Re: Reusing code from SAS Program in another SAS Program #6 1547525
Keith, You have two choices: 1st.: create macros containing your if statements and store them either in a user or public macro library. 2nd.: Create text files contaiing your if statements save them in a PDS and %include them in your program. Toby Dunn From: Keith <kmccall00@CHARTER.NET> Reply-To: Keith <kmccall00@CHARTER.NET> To: SAS-L@LISTSERV.UGA.EDU Subject: Reusing code from SAS Program in another SAS Program Date: Fri, 20 May 2005 15:23:07 -0700 I write SAS programs on the Mainframe. I have several programming steps in multiple programs that use the same IF state...

Re: Reusing code from SAS Program in another SAS Program #7 1547527
Hi Keith, is it exactly the same code (a) or only the same structure but with different variable names in it (b) ? (a) you may save the "IF code" in a separate member (let's say IFcode) and simply %INCLUDE that member within your various data stes. FILENAME xxx FILENAME xxx 'a.b.c.' DISP=shr; DATA ... SET ... %INCLUDE xxx(IFcode); run; (b) you could use the same technique but with macro logic in order to set the variable names dynamically before including IFcode does this help ? Regards Roland -----Original Message----- From: SA...

Re: Reusing code from SAS Program in another SAS Program #6 647520
Thanks for the clarification Ian - =20 That's why I love SAS-L so much. :) This is the second new-to-me thing = this morning. =20 http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000214504.htm= <sasdoc> Rules for Using %INCLUDE You can specify any number of sources in a %INCLUDE statement, and you = can mix the types of included sources. Note, however, that although it is possible to include information from multiple sources in one %INCLUDE statement, it might be easier to understand a program that uses = separately coded %INCLUDE statements for each source. The %INCLUD...

Web resources about - Re: How to call another program within a program in SAS??? - comp.soft-sys.sas

Passwords, privacy and protection—can Apple meet FBI's demand without creating a 'backdoor'?
The San Bernardino terrorist suspect Syed Rizwan Farook used an iPhone 5c, which is now in the possession of the FBI. The iPhone is locked. The ...

The Latest: Storms hit the South, causing death and damage
KENNER, La. (AP) — The Latest on deadly storm system that spawned tornadoes in Gulf Coast states (all times local):

Five ways scientists are going after the Zika virus
Los Angeles Times Five ways scientists are going after the Zika virus Los Angeles Times University of Washington immunologist Michael Gale ...

Pound falls below $1.39 for first time in nearly seven years as HSBC warns 'Brexit' could wipe 15% off ...
In late morning trading, the pound dropped almost 1 per cent to $1.3878, its lowest level since March 2009, while sterling also fell 0.5 per ...

Ryan Reynolds would like the Academy to consider 'Deadpool' for an Oscar
Despite the fact that the 2016 Oscars are less than a week out, Ryan Reynolds has a plea for the Academy: Vote for Deadpool . As it currently ...

Google robot opens doors, picks itself up after getting knocked over in crazy video
Boston Dynamics, a robotics company that Google bought back in 2013, has routinely wowed the world by releasing videos of robots that are growing ...

Wreckage of missing plane found in Nepal, all 23 aboard dead
KATHMANDU, Nepal — Rescuers found the wreckage of a small plane carrying 23 people that crashed into a mountain in Nepal due to bad weather on ...

Kanye West goes on a Twitter rant about critic Bob Ezrin: justified or nah?
Another day, another Kanye West Twitter rant. What’s consistently interesting to me is that Kanye has no problem with telling the world he’s ...

Uber Shooting Update: Female Kalamazoo Victim, 14, ‘Declared Brain Dead’ Suddenly Squeezes Mom’s Hand ...
Despite the heinous mass shooting perpetuated in Kalamazoo, Michigan days ago by Uber driver, Jason Dalton, one family has reason to celebrate ...

How Facebook’s new ‘reactions’ buttons will change your Facebook experience
Great news for anyone who's ever wanted to post a different reaction other than "liking" a friend's Facebook status starting today, you'll be ...

Resources last updated: 2/24/2016 2:24:47 PM