Date: Fri, 23 Dec 2011 10:20:48 -0500
Reply-To: Vincent Hunter <chunter1@STUDENT.GSU.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Vincent Hunter <chunter1@STUDENT.GSU.EDU>
Subject: Problem replacing Macro Variables in Simulation
Content-Type: text/plain; charset=ISO-8859-1
I am trying to create a file with syntax for running an R function.
The syntax has variable file names, and is part of a simulation, so it I
have coded it within a macro. I am having problems getting the macro
variables to resolve and writing the syntax file. Any help will be
appreciated.
The following (partial code) allows creation of the syntax file, but the
macro variables do not resolve.
data _null_ ;
file 'C:\Program Files\R\R-2.14.0\bin\runlink.r';
PUT ' library(plink)' ;
PUT ' setwd("g:/BILOGfiles")' ;
PUT ' gr.pars <- read.bilog("&ref&r..par")' ;
PUT ' gf.pars <- read.bilog("&foc&r..par")' ;
. . . ;
If I take the lines with macro variables and replace the ‘ with a macro
variable that resolves to a ‘ (e.g., PUT &tic write.csv
(conname,"L&foc&r..csv") &tic ;), I get the following errors, among
others”
22: LINE and COLUMN cannot be determined.
ERROR 22-322: Syntax error, expecting one of the following: a name,
a quoted string, arrayname, #, (, +, /, //, ;, @, @@,
OVERPRINT,
_ALL_, _BLANKPAGE_, _ODS_, _PAGE_.
200: LINE and COLUMN cannot be determined.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR: Invalid variable specification, read.bilog.
Variable names of the form X.X must be either FIRST.X or LAST.X.
ERROR: Missing numeric suffix on a numbered variable list (NAME-bilog).
NOTE 138-205: Line generated by the macro variable "R".
1 "ir20m0s1hK111
--------------
22
76
ERROR 22-322: Syntax error, expecting one of the following: a name,
arrayname,
_ALL_, _CHARACTER_, _CHAR_, _NUMERIC_.
ERROR 76-322: Syntax error, statement will be ignored.
I have also tried submitting the lines as %str data:
put
%str("library("plink") ")
%str("setwd("g:BILOGfiles")")
%str("gr.pars <- read.bilog("&ref&r..par")")
%str("gf.pars <- read.bilog("&foc&r..par")")
%str("common <- matrix (c(1:&items,1:&items), &items, 2)")
. . . :
And get these errors, whether I submit the lines as a group or with
individual PUT statements:
NOTE: Line generated by the invoked macro "RUNPLINK".
3 data program ; file 'C:\Program Files\R\R-2.14.0\bin\runlink.r';
put
3 ! "library("plink") " "setwd("g:BILOGfiles")" "gr.pars <-
---------- --------
49 49
3 ! read.bilog("&ref&r..par")"
NOTE: Line generated by the macro variable "R".
1 "gr.pars <- read.bilog("ir20m0s1hK111
-----------------------------------------
49 557
ERROR: DATA STEP Component Object failure.
Aborted during the COMPILATION phase.
NOTE 49-169: The meaning of an identifier after a quoted string may change
in a
future SAS release. Inserting white space between a quoted
string
and the succeeding identifier is recommended.
ERROR 557-185: Variable ir20m0s1hK111 is not an object.
|