Hi,
I was wondering if it is possible to be able and have SAS include a datasets headers in the first row of the data and also insert a row above that with a string value in the first column.
Below I've included some code which shows my sample data and what I am looking to achieve.
Any other questions or further information let me know.
Sandy
%let have_id = 'abc123';
proc sql noprint;
create table work.have_data (test1 char(6),test2 char(6),test3 char(6))
;
insert into work.have_data (test1,test2,test3)
values ('a','b','c')
values ('d','e','f')
values ('g','h','i')
values ('j','k','l')
;
quit;
proc sql noprint;
create table work.want (col1 char(6),col2 char(6),col3 char(6))
;
insert into work.want (col1,col2,col3)
values (&have_id,'','')
values ('test1','test2','test3')
values ('a','b','c')
values ('d','e','f')
values ('g','h','i')
values ('j','k','l')
;
quit;
What possible value could you get out of that?
Sounds like you want a print out of your data. Use PROC PRINT.
Here is an example:
%let dsn=sashelp.class(obs=3);
title "&dsn";
proc print data=&dsn;
run;
No, for several reasons:
Liberate yourself from Excel thinking.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.