BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mgrzyb
Quartz | Level 8

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;

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
mgrzyb
Quartz | Level 8

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

11 REPLIES 11
mgrzyb
Quartz | Level 8

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;

mgrzyb
Quartz | Level 8

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;

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;
mgrzyb
Quartz | Level 8
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.
mgrzyb
Quartz | Level 8
I thought I gave KUDOS TO YOU!!! I accepted yours as the solution. Please don't be angry!

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

mgrzyb
Quartz | Level 8

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

MichaelLarsen
SAS Employee

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

mgrzyb
Quartz | Level 8

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. 

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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