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

Hi,

I am having a situation when i am creating format

Proc Sql;

create table test1 as

select cntyname,cnty_id

from cnty table

where cnty_id in (select cnty_id from test);

quit;

data test2;

set test1;

retain fmtname 'cnty'

rename cnty_id=start;

  rename  cntyname=label;

run;

proc format library=format  cntlin=cnty;

run;

This runs well when i am having data in test1 but when i am having no data it says it cannot load format cnty.Even though i am having no data it should not throw an error.

Can any one help me how to avoid this.

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Proc Sql;

create table cntyFmt as

select "cnty" as fmtname, cntyname as label, cnty_id as start

from cnty

where cnty_id in (select cnty_id from test);

quit;

proc format library=format cntlin=cntyFmt;

run;

PG

View solution in original post

4 REPLIES 4
PGStats
Opal | Level 21

Proc Sql;

create table cntyFmt as

select "cnty" as fmtname, cntyname as label, cnty_id as start

from cnty

where cnty_id in (select cnty_id from test);

quit;

proc format library=format cntlin=cntyFmt;

run;

PG
JasonNC
Quartz | Level 8

Hey But i think we have to use cntlin=cnty instead of cntyFmt

PGStats
Opal | Level 21

With PROC SQL you create the table called cntyFmt with the proper variables : FMTNAME, LABEL and START and then use CNTLIN=cntyFmt to tell PROC FORMAT the name of the format control dataset. You could use any name instead of cntyFmt.

Cheers!

PG

PG
JasonNC
Quartz | Level 8

oops i got it previously i was using

proc format cntlin=cnty;

so i was getting that problem

Now i am using

Proc format library=format

cntlin=cnty;

when i used the above one i am not getting that problem.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1851 views
  • 0 likes
  • 2 in conversation