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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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