BookmarkSubscribeRSS Feed
ursula
Pyrite | Level 9

Is it a way to arange the column (variable) of the dataset by drag and drop from 'viewtable' window?

thanks

5 REPLIES 5
ballardw
Super User

I find it a tad awkward and it isn't consistent but within viewtable you can click on the column heading once the left click and hold to drag the column. However this doesn't, at least in my install of SAS 9.2.3 and Windows 7, allow dragging a column past the current displayed boundaries of the window (i.e. can't keep going left or right). Also the order is ONLY for the current view. It does not actually change the order of the columns in the dataset. When you close the view and reopen the previous column you have to got through the process again if you want to look at columns.

ursula
Pyrite | Level 9

thanks, yes, I have noticed it too. it will not stay even I have click the save botton.

I just exported it to excel and rearrange the column and then imported back to the sas datasets.

Hope in the future we are able to do it directly from viewtable window.

Reeza
Super User

Typically if I need to arrange columns, I'll recreate the dataset (assuming its not too large) using proc sql and then arrange the variables the order I want them.

proc sql feedback;

select * from want;

quit;

Check the log after running that and it will include all your variables and then you can order them a little bit more easily (IMO).

ursula
Pyrite | Level 9

yes, this is an alternative way to do. The problem  is, I have so many variables in my dataset.

btw, thank for the response.

VD
Calcite | Level 5 VD
Calcite | Level 5

You could also use proc contents or proc sql to get the variable names:

proc contents data=have out=want ; run;

OR

proc sql; describe table have; quit; Check the log for the variable names.

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
  • 5 replies
  • 542 views
  • 0 likes
  • 4 in conversation