Windows 10, SAS Version 9.4
I would like to add 2 observations to a dataset. To do so, I wrote the following code within a macro prior to sort and merge by variable named "compound2" of type char $3.
data work.addcompounds2GFC;
input compound2=$3. GFC_Suc_MPB= Final_Weigh_SD=;
datalines;
compound2=Cl GFC_Suc_MPB=0 Final_Weigh_SD=0
compound2=S GFC_Suc_MPB=0 Final_Weigh_SD=0
;
proc print data=work.addcompounds2GFC; run;
When I compile just the code as shown above, the result is just the desired dataset (work.addcompounds2GFC).
I was also able to do this using cards:
data work.addcompounds2GFC;
length compound2 $3;
input compound2 $ GFC_Suc_MPB Final_Weigh_SD;
cards;
Cl 0 0
S 0 0
;
run;
This code is nested within a macro. While compilation works in pieces, running the macro as a whole leads to the following error message:
ERROR: The macro RUN4_CALCULATIONS generated CARDS (data lines) for the DATA step, which could
cause incorrect results. The DATA step and the macro will stop executing.
What I want, and this works if I just run a portion of code within the macro, is to combine this data with another dataset with the new observations for Cl and S:
Thank you, Jane
Thank you for the quick reply.
The information at the link was informative and the following correction fixed the problem.
proc sql;
create table work.addcompounds2GFC(compound2 char(3), GFC_Suc_MPB num, Final_Weigh_SD num);
insert into work.addcompounds2GFC
values('S',0,0)
values('Cl',0,0);
Thanks again. Cheers!
Jane
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.