Hi @PaigeMiller , many thanks for your help. Here is the code I'm running: /*Importing Final Data Set*/
options MSGLEVEL=I;
options validvarname=v7;
proc import out=one
datafile='C:\Users\JAZHU\Desktop\LHC_Links\Excel_for_SAS.xlsx'
DBMS=xlsx replace;
getnames=yes;
run;
proc print data=one (obs=10);
run;
proc contents data=one;
run;
%macro comb(idn, pidn, eventn, eventnum, pagen, instancen);
data two;
set one;
if id=&idn and pid=&pidn and unique_event_name=&eventn and event_id=&eventnum and page=&pagen and instance=&instancen
then qi106=cats(redcap_version, "DataEntry/index.php?pid=", &pidn, "&id=", &idn, "&page=", &pagen, "&event_id=", &eventnum, "&instance=", &instancen)
else qi106="";
run;
%mend;
%comb(id, pid, unique_event_name,event_id, page, instance);
options mprint; Basically, I am trying to create a new variable, qi106, that is a concatenation of the values of a variety of variables. This is to be done for each row in my dataset, and my dataset has 172225 rows. The variables of my dataset are as follows: The log is here: NOTE: Copyright (c) 2016 by SAS Institute Inc., Cary, NC, USA. NOTE: SAS (r) Proprietary Software 9.4 (TS1M7) Licensed to J HPKNS UNV-BLOOMBERG SCH OF PUB HLTH DEPT OF EPID, Site 70092145. NOTE: This session is executing on the X64_10PRO platform. NOTE: Analytical products: SAS/STAT 15.2 SAS/ETS 15.2 SAS/OR 15.2 SAS/IML 15.2 SAS/QC 15.2 NOTE: Additional host information: X64_10PRO WIN 10.0.19041 Workstation NOTE: SAS initialization used: real time 0.94 seconds cpu time 0.78 seconds 1 /*Importing Final Data Set*/ options MSGLEVEL=I; 2 options validvarname=v7; 3 options mprint; 4 proc import out=one 5 datafile='C:\Users\JAZHU\Desktop\LHC_Links\Excel_for_SAS.xlsx' 6 DBMS=xlsx replace; 7 getnames=yes; 8 run; NOTE: VARCHAR data type is not supported by the V9 engine. Variable id has been converted to CHAR data type. NOTE: VARCHAR data type is not supported by the V9 engine. Variable unique_event_name has been converted to CHAR data type. NOTE: VARCHAR data type is not supported by the V9 engine. Variable page has been converted to CHAR data type. NOTE: VARCHAR data type is not supported by the V9 engine. Variable redcap_version has been converted to CHAR data type. NOTE: The import data set has 296037 observations and 7 variables. NOTE: WORK.ONE data set was successfully created. NOTE: PROCEDURE IMPORT used (Total process time): real time 11.24 seconds cpu time 11.25 seconds 9 10 proc print data=one (obs=10); NOTE: Writing HTML Body file: sashtml.htm 11 run; NOTE: There were 10 observations read from the data set WORK.ONE. NOTE: PROCEDURE PRINT used (Total process time): real time 0.28 seconds cpu time 0.15 seconds 12 13 proc contents data=one; 14 run; NOTE: PROCEDURE CONTENTS used (Total process time): real time 0.01 seconds cpu time 0.00 seconds 15 %macro comb(idn, pidn, eventn, eventnum, pagen, instancen); 16 data two; 17 set one; 18 if id=&idn and pid=&pidn and unique_event_name=&eventn and event_id=&eventnum and page=&pagen and 18 ! instance=&instancen 19 then qi106=cats(redcap_version, "DataEntry/index.php?pid=", &pidn, "&id=", &idn, "&page=", 19 ! &pagen, "&event_id=", &eventnum, "&instance=", &instancen) 20 else qi106=""; 21 run; 22 %mend; 23 %comb(id, pid, unique_event_name,event_id, page, instance); MPRINT(COMB): data two; MPRINT(COMB): set one; WARNING: Apparent symbolic reference ID not resolved. WARNING: Apparent symbolic reference PAGE not resolved. WARNING: Apparent symbolic reference EVENT_ID not resolved. WARNING: Apparent symbolic reference INSTANCE not resolved. NOTE 137-205: Line generated by the invoked macro "COMB". 2 &eventnum, "&instance=", &instancen) else qi106=""; run; ---- 22 ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, ;, <, <=, <>, =, >, ><, >=, AND, EQ, GE, GT, IN, LE, LT, MAX, MIN, NE, NG, NL, NOT, NOTIN, OR, ^, ^=, |, ||, ~, ~=. NOTE: Line generated by the invoked macro "COMB". 2 &eventnum, "&instance=", &instancen) else qi106=""; run; ---- 202 ERROR 202-322: The option or parameter is not recognized and will be ignored. MPRINT(COMB): if id=id and pid=pid and unique_event_name=unique_event_name and event_id=event_id and page=page and instance=instance then qi106=cats(redcap_version, "DataEntry/index.php?pid=", pid, "&id=", id, "&page=", page, "&event_id=", event_id, "&instance=", instance) else qi106="" ; MPRINT(COMB): run; NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column). 1:150 2:50 NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set WORK.TWO may be incomplete. When this step was stopped there were 0 observations and 8 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds Any thoughts?
... View more