Hello,
My dataset look like this (see below) and is exported to excel with ods. I would like to add free text in a different sheet in the same excel file. The free text should look like this (like a log):
2021-09-22: Changed variabelname for City
2021-09-20: Made uppercase fo City
2021-09-18: Created dataset
2021-09-15: Created a mean
I have tried different ways but have not found any good solution to export free text to excel.
data have;
;
input City$ month$ year2017 year2018 year2019 mean2017_2019;
datalines;
London Jan 10 15 20 15
Rom Jan 20 25 30 25
Paris Jan 20 10 10 13.33
Berlin Jan 50 60 70 60
London Feb 20 30 40 30
Rom Feb 40 50 60 50
Paris Feb 40 20 20 26.67
Berlin Feb 100 90 50 80
;
run;
ODS EXCEL FILE='c:\file-path\Cities.xlsx'
options (sheet_interval='none' suppress_bylines="off" sheet_name="City);
PROC REPORT data=have;
run;
ODS EXCEL CLOSE;
Datasets contain variables, variables contain data.
To add data to a dataset, add a variable and give it a value:
data want;
input free_text $80.;
datalines;
Free Text
Another Free Text
;
Put your "free text" in a SAS data set. Then:
ods excel file='c:\file-path\Cities.xlsx' options (sheet_interval='none' suppress_bylines="off"
sheet_name="City");
proc report data=have;
run;
ods excel options(sheet_name='Free Text');
proc print data=free_text;
run;
ODS EXCEL CLOSE;
Datasets contain variables, variables contain data.
To add data to a dataset, add a variable and give it a value:
data want;
input free_text $80.;
datalines;
Free Text
Another Free Text
;
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.