BookmarkSubscribeRSS Feed
GeorgeSAS
Lapis Lazuli | Level 10

Hello everyone,

How I can remove variable y's format in proc sql?

proc sql noprint;

create table two as

select x,  y format=_null_ from one;

quit;

Thanks

5 REPLIES 5
BrunoMueller
SAS Super FREQ

Hi George

Proc SQL expects a format name in the syntax, you could use a generic one like BEST. for numeric values. In order to remove a format from a variable, you can use Proc DATASETS.

Something like

proc datasets lib=work nolist;

  modify two;

    format y;

run;

  contents data=two;

run;

quit;

Will work

Tom
Super User Tom
Super User

No, one of the limitations of way that PROC SQL supports formats.

Now you could trick SAS into thinking you have created a NEW variable so not have the format (or the label for that matter) carried forward.

select x, y+0 as y ....

brucehughw
Obsidian | Level 7

Will the trick you suggest work for character variables? I have all sorts of airport codes, e.g. KBOS maps to 'Logan International ...', but

sometimes I just want KBOS, so that I can save that in a macro variable that I later use as an argument to a macro.

 

Thanks, Bruce

Reeza
Super User
Use a plain jane character format.
Format=$50.
brucehughw
Obsidian | Level 7
Ah, so easy. Thanks!

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 5 replies
  • 6623 views
  • 1 like
  • 5 in conversation