BookmarkSubscribeRSS Feed
aarony
Obsidian | Level 7

hi, i want to drop a variable called "global company id"

how can i drop this?

simnply saying:

data work1;

set base1 (drop = global company key);

run;

is not working. thank you

7 REPLIES 7
Reeza
Super User

SAS doesn't  usually allow variable names with spaces, so either the variable name is actually global_company_id, or if it actually has spaces you need to refer to it as "global company id"n.

aarony
Obsidian | Level 7

thank you so much for your kind reply Reeze:

this is what i got from proc contents

11 at       Num    8 F18.4              Assets - Total

  12 capx     Num    8 F18.4              Capital Expenditures

  13 ceq      Num    8 F18.4              Common/Ordinary Equity - Total

   9 conm     Char  57 $57.      $57.     Company Name

   5 consol   Char   2 $2.       $2.      Level of Consolidation - Company Annual Descriptor

  22 costat   Char   1 $1.       $1.      Active/Inactive Status Marker

when i view table i see Assets-total. is it possible to at instead of assets-total. it is very difficult to code by looking at the view table.

Reeza
Super User

Your variable NAME is AT and that's what you should use in your code.

Your variable LABEL is Assets-Total

You can switch the view in SAS by going to View>Column Names, but this doesn't 'stick'.

Yes its a pain in the ass.  Another option is to strip all labels from a dataset, but with truncated variable names that has its own problems. 

I believe the following line will remove the labels from all variables.

attrib _all_ label = "";

ballardw
Super User

If you use command instead of the point & click menu to open a data set: Vt <data set name goes here>;colnames; will open view table with names instead of labels.

Or better, open the Keys menu, default F9, and add a command to a key:

vt _last_; colnames;

Then pressing the key combination you selected will bring up the last created data set with column names.

Reeza
Super User

Thanks, that's handy.

I'd still prefer an option to have the column names show by default rather than the labels.

PaigeMiller
Diamond | Level 26

Steps 1 through 4 here make the column names the default

http://listserv.uga.edu/cgi-bin/wa?A2=ind0708d&L=sas-l&P=6458

--
Paige Miller
ballardw
Super User

And if you want to sort the data in the tables or make data edits add openmode=edit

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 7 replies
  • 839 views
  • 8 likes
  • 4 in conversation