Questions tagged [sas-macro]

A metaprogramming language used in the SAS suite to modify normal SAS code at run-time.

SAS Macro language offers more flexibility for programming SAS code. SAS code written with SAS Macro will be compiled before execution. SAS Macro language uses % for calling SAS macro functions and for calling and defining macros, e.g.:

%macro temp;
  %put %sysfunc(date());
%mend;
%temp;

Variables are used with &, e.g.:

%let my_var = "Hello World";
%put &my_var.;

More about

1265 questions
0
votes
1 answer

Debugging error:Required operator not found in expression

am working on the study day macro below but it gives an error in the log the program is a reference code as am new to clinical sas i was trying to calculate studyday by accepting 3 columns from 3 tables to be used to calculate the studyday... can u…
0
votes
2 answers

How to import multiple .dbf files in SAS

%let dirname = C:\Users\data; filename DIRLIST pipe 'dir/B &dirname\*.dbf'; /* Create a data set with one observation for each file name */ data dirlist; length fname $8.; infile dirlist length=reclen; input fname $8.; run; …
sayan de sarkar
  • 185
  • 1
  • 10
0
votes
1 answer

SAS SymputX and Symget Function

I try to construct Table 2 by writing below SAS code but what I get is the Table 1. I could not figure out what I missed. Help very appreciated Thank you. &counter = 4 data new;set set1; total = 0; a = 1; do i = 1 to…
Jonsi Billups
  • 133
  • 1
  • 3
  • 15
0
votes
1 answer

Create Table with Loop in SAS

When you have a table like; somefield1 somefield2 lastterm1 lastterm2 (10) (20) (1) (-) (20) (40) (1) (2) (30) (50) (-) (2) and try to group for each term, is there an easier way to do it rather than; PROC SQL; CREATE TABLE WORK.LAST_TERM1 AS…
kutayatesoglu
  • 27
  • 1
  • 7
0
votes
2 answers

char variable in clause cannot be accessed

i want to access char variable in where clause like below--> %macro obs(indsn=, outdsn=, clause=, col=, optr=, subset_val=); data &outdsn; set &indsn; &clause &col &optr &subset_val; run; proc print data= &outdsn;run; %mend…
0
votes
1 answer

Generate and run SAS-code based on data in file

I have written several SAS macro functions, each of them has some input parameters. Let's say for this example that this functions are: %macro add(dataset,column,number); data &dataset; set &dataset; &column = &column +…
user54060
  • 3
  • 1
0
votes
1 answer

SAS: Quoting Problems

I am trying to generate a script from within SAS. Unfortunately, I need to write the line strMSHTA = "mshta.exe ""about:" _ & "