Have you ever linked SAS code, If so, describe the link and
any required statements used to either process the code or
the step itself?

Answer Posted / bakul shah

Another way to call Subroutine.
Example:
*========================================================
* Bakul Shah
* HOW MANY DIFFERENT WAYS IT IS POSSIBLE TO MAKE
* CHANGE FOR A DOLLAR? ---> 292 Posibilities ??
*
* H HALF DOLLAR
* Q QUARTER
* D DIME
* N NICKEL
* P PENNY
* A LOOP - INITIALIZE TO ZERO
* NO LINE NUMBER - INITIALIZE TO 55
* KOUNT TOTAL NUMBER INITIALIZE TO ZERO
* ;

/* The file 'c:coinpage.txt' is:
File Name=C:\WINDOWS\system32\coinpage.txt,
RECFM=V,LRECL=256 */

Data Null_ ;
/* file 'c:coinpage.txt'; */
File CoinPage ;
A=0 ;
PageCount = 0 ;
NO=55; Retain NO;
KOUNT=0;
DO H = A to 2; /* Half Dollar */
DO Q = A to 4; /* Quarter */
DO D = A to 10; /* Dime */
DO N = A to 20; /* Nickle */
DO P = A to 100; /* Cents */
IF(((H*50)+(Q*25)+(D*10)+(N*5)+P)=100) THEN
do;
KOUNT+1 ;
If NO > = 55 then
do;
Link PageHeader;/* Calling Subroutine*/
end;
NO+1 ;
Put @9 KOUNT 3. @18 H 3. @27 Q 3.
@36 D 3. @45 N 3. @54 P 3. ;
end;
end;
end;
end;
end;
end;
Return;

PageHeader: /* Subroutine */
PageCount + 1 ;
Put @70 'Page' +0 PageCount 2.
/@8 'KOUNT' @20 'H' @29 'Q' @38 'D'
@47 'N' @56 'P' ;
NO = 0 ;
Return;
Run;

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the ways to do a “table lookup” in sas?

824


Differences between where and if statement?

822


what is the Population you used in your project, is it ITT or PP?

2529


how would you determine the number of missing or nonmissing values in computations? : Sas programming

943


What is a put statement?

981


what is business intelligence? : Sas-bi

840


Can you execute macro within another macro? If so, how would sas know where the current macro ended and the new one began? : sas-macro

983


Do we follow ADAM in analysis dataset development?How? Usually which version? Why is it necessary?

2202


explain the use of % includes a statement in sas? : Sas-administrator

801


What does proc print, and proc contents are used for?

853


Mention the category in which sas informats are placed?

828


Mention some common errors that are usually committed in sas programming.

852


What do you know about sas and what we do? : sas-grid-administration

839


Are you sensitive to code walk-throughs peer review or QC review?

2942


Describe the ways in which you can create a macro variable?

867