Help using Base SAS procedures

PROC FORMAT CNTLIN

Accepted Solution Solved
Reply
Regular Contributor
Posts: 155
Accepted Solution

PROC FORMAT CNTLIN

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.


Accepted Solutions
Solution
‎03-13-2012 03:40 PM
Respected Advisor
Posts: 4,646

PROC FORMAT CNTLIN

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


All Replies
Solution
‎03-13-2012 03:40 PM
Respected Advisor
Posts: 4,646

PROC FORMAT CNTLIN

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
Regular Contributor
Posts: 155

PROC FORMAT CNTLIN

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

Respected Advisor
Posts: 4,646

PROC FORMAT CNTLIN

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
Regular Contributor
Posts: 155

PROC FORMAT CNTLIN

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.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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