DATA Step, Macro, Functions and more

printing proc contents using NO ODS and justifying all proc contents to the left.

Accepted Solution Solved
Reply
Contributor
Posts: 47
Accepted Solution

printing proc contents using NO ODS and justifying all proc contents to the left.

Hi. I have this code where I print out only the variable names.  I saw all the discussions on left justification, but they all require ODS.

 

Is there a way USING NO ODS to justify to the left the var names in the last proc statement?

* export the variable names and their position number into a data set called "data_info";

proc contents

data = maosim.case_5_pre_and_post_mgnew

noprint

out = data_info

(keep = name varnum);

run;

 

 

* sort "data_info" by "varnum";

* export the sorted data set with the name "variable_names", and keep just the "name" column;

proc sort

data = data_info

out = variable_names(keep = name);

by varnum;

run;

 

 

* view the list of variables;

proc print

data = variable_names

noobs ;

run;

 

 

 

 


Accepted Solutions
Solution
3 weeks ago
Contributor
Posts: 47

Re: printing proc contents using NO ODS and justifying all proc contents to the left.

Posted in reply to MichaelLarsen

I tried this and it did not work.  Perhaps I have placed the options in the wrong statement ----

 

 

* export the variable names and their position number into a data set called "data_info";
proc contents
data = maosim.case6apre_6bpost_mgf
noprint
out = data_info
(keep = name varnum);
run;


* sort "data_info" by "varnum";
* export the sorted data set with the name "variable_names", and keep just the "name" column;
proc sort
data = data_info
out = variable_names(keep = name);
by varnum;
run;


* view the list of variables;
proc print OPTIONS NOCENTER
data = variable_names
noobs ;
run;

View solution in original post


All Replies
SAS Employee
Posts: 28

Re: printing proc contents using NO ODS and justifying all proc contents to the left.

have you tried:
OPTIONS NOCENTER;
Solution
3 weeks ago
Contributor
Posts: 47

Re: printing proc contents using NO ODS and justifying all proc contents to the left.

Posted in reply to MichaelLarsen

I tried this and it did not work.  Perhaps I have placed the options in the wrong statement ----

 

 

* export the variable names and their position number into a data set called "data_info";
proc contents
data = maosim.case6apre_6bpost_mgf
noprint
out = data_info
(keep = name varnum);
run;


* sort "data_info" by "varnum";
* export the sorted data set with the name "variable_names", and keep just the "name" column;
proc sort
data = data_info
out = variable_names(keep = name);
by varnum;
run;


* view the list of variables;
proc print OPTIONS NOCENTER
data = variable_names
noobs ;
run;

SAS Employee
Posts: 28

Re: printing proc contents using NO ODS and justifying all proc contents to the left.

it is:
OPTIONS NOCENTER;
PROC PRINT ......
Contributor
Posts: 47

Re: printing proc contents using NO ODS and justifying all proc contents to the left.

THIS HERE WORKED !!!!!   YAYE!!!!    Thanks for the idea and start... you were very helpful!

 

* export the variable names and their position number into a data set called "data_info";
proc contents
data = maosim.case6apre_6bpost_mgf
noprint
out = data_info
(keep = name varnum);
run;


* sort "data_info" by "varnum";
* export the sorted data set with the name "variable_names", and keep just the "name" column;
proc sort
data = data_info
out = variable_names(keep = name);
by varnum;
run;


* view the list of variables;
options linesize=132 pagesize=60 nocenter date;

proc print
data = variable_names
noobs ;
run;

Super User
Super User
Posts: 9,861

Re: printing proc contents using NO ODS and justifying all proc contents to the left.

Its a good idea to mark the person who provided you the solution's post as the answer, not your own response.

Anyways, that code is not needed, you can simply (please note the use of the code window, its the {i} above the post are):

options nocenter;

proc print data=sashelp.vcolumn noobs;
where libname="MAOSIM" and memname="CASE6APRE_6BPOST_MGF";
run;
Contributor
Posts: 47

Re: printing proc contents using NO ODS and justifying all proc contents to the left.

I am sorry, who should I give graditude to? I thought I gave it to you? I thank you very much!
What can I do to correct this? I accepted yours as the solution.
Contributor
Posts: 47

Re: printing proc contents using NO ODS and justifying all proc contents to the left.

I thought I gave KUDOS TO YOU!!! I accepted yours as the solution. Please don't be angry!

Super User
Super User
Posts: 9,861

Re: printing proc contents using NO ODS and justifying all proc contents to the left.

I am not, just mark the poster who provided the solution, in this case @MichaelLarsen, as the correct answer.  Just to note for future as I don't think you can change it now.  Never actually seen that kudos and what not thing, just want the actual answer to appear below the question, makes future searches easier.

Contributor
Posts: 47

Re: printing proc contents using NO ODS and justifying all proc contents to the left.

Michael,

I can not find your email to apologize.  I really did not know the rules for accepting a solution.  Thank you for informing me.  

 

Should there be as SAS COMMUNITY RULE documents?  I am not greedy and I thought I gave credit to you. 

 

I am sorry. 

 

I hope the SAS community accepts our mistakes are we not SAS experts per se, and don't know the rules. 

 

I thought everyone was suppose to be kind and open instead of critical.  But I have learned.  

 

Thank you again for the solution. 

 

Marysia

SAS Employee
Posts: 28

Re: printing proc contents using NO ODS and justifying all proc contents to the left.

No problem at all Smiley Happy

 

Like RW9 says, if the actual solution is marked, it is easier for others having a similar problem to find the solution.

 

It is not about personal glory Smiley Happy

Contributor
Posts: 47

Re: printing proc contents using NO ODS and justifying all proc contents to the left.

Posted in reply to MichaelLarsen

Michael,

I can not find your email to apologize.  I really did not know the rules for accepting a solution.  Thank you for informing me.  

 

Should there be as SAS COMMUNITY RULE documents?  I am not greedy and I thought I gave credit to you. 

 

I am sorry. 

 

I hope the SAS community accepts our mistakes are we not SAS experts per se, and don't know the rules. 

 

I thought everyone was suppose to be kind and open instead of critical.  But I have learned.  

 

Thank you again for the solution. 

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 11 replies
  • 115 views
  • 0 likes
  • 3 in conversation