- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
sas stored process create new variable sas code
PROC SQL;
CREATE TABLE DATA1 AS
SELECT
t1.HEAD,put(input(t1.HEAD,best4.),z4.) as HEAD1
from data t1
quit;
ods markup file="//report/data.xls" tagset=tagsets.test alias='normal' style=mystyle;
proc report data=data;
run;
excel output not display and columns not display
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Use in below code the option to create and populate variable HEAD that fits your data the best.
It's just about applying the right format to the SAS variable so SAS can "tell" Excel how to represent the value.
data class;
set sashelp.class;
Age_c=put(age, 3.);
run;
PROC SQL;
CREATE TABLE DATA1 AS
SELECT
t1.Name,
put(input(t1.Age_c,best4.),z4.) as HEAD1 format=$4.,
input(t1.Age_c,best4.) as HEAD2 format=z4.,
t1.age as HEAD3 format=z4.
from class t1;
quit;
ods excel file="c:\temp\data.xlsx";
proc report data=data1;
run;
ods excel close;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Read the log, or post it here so that we see what's happening actually.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hell @Daily1
If your intention is to create an excel file, why not use ods excel instead of ods markup?
I am giving an example code approximating your code. Try this and it should work.
data class;
set sashelp.class;
Age_c=put(age, 3.);
run;
PROC SQL;
CREATE TABLE DATA1 AS
SELECT
t1.Name, put(input(t1.Age_c,best4.),z4.) as HEAD1
from class t1;
quit;
ods excel file="/home/theprogmin/data.xlsx" ;
proc report data=data1;
run;
ods excel close;
If this does not work, do post the complete log as text - not as an image or screen shot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Use in below code the option to create and populate variable HEAD that fits your data the best.
It's just about applying the right format to the SAS variable so SAS can "tell" Excel how to represent the value.
data class;
set sashelp.class;
Age_c=put(age, 3.);
run;
PROC SQL;
CREATE TABLE DATA1 AS
SELECT
t1.Name,
put(input(t1.Age_c,best4.),z4.) as HEAD1 format=$4.,
input(t1.Age_c,best4.) as HEAD2 format=z4.,
t1.age as HEAD3 format=z4.
from class t1;
quit;
ods excel file="c:\temp\data.xlsx";
proc report data=data1;
run;
ods excel close;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
English is also not my native language but ... can you please re-formulate what you've trying to say because currently it's all gibberish to me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
First create Stored process this code after excel output not show
data class;
set sashelp.class;
Age_c=put(age, 3.);
run;
PROC SQL;
CREATE TABLE DATA1 AS
SELECT
t1.Name,
put(input(t1.Age_c,best4.),z4.) as HEAD1 format=$4.,
input(t1.Age_c,best4.) as HEAD2 format=z4.,
t1.age as HEAD3 format=z4.
from class t1;
quit;
ods excel file="c:\temp\data.xlsx";
proc report data=data1;
run;
ods excel close;