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

Hi all,

I am facing this issue. Please help me with the error.  I have a dataset named continent with 2 variables-continentid and continent name. I want to create a control input dataset named continent and store it in myfmt catalog  and use the format on continentid var.name of the format is continent

archita_0-1645874760691.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

The CNTLIN data set, continent, was created incorrectly. 

 

For the start and label, it assigns only one value which will always map the VALUE continent_ID to the continent_name. I think you likely meant to refer to those as variables not constants. 

 

Remove the quotes around the variables. 

 

FYI - if you post a picture of your code we'll have to explain to you how to modify it. 

If you post the actual code, we can show the suggested changes. Post your code and log directly in the future, not an image. 

 


@archita wrote:

Hi all,

I am facing this issue. Please help me with the error.  I have a dataset named continent with 2 variables-continentid and continent name. I want to create a control input dataset named continent and store it in myfmt catalog  and use the format on continentid var.name of the format is continent

archita_0-1645874760691.png

 


 

 

View solution in original post

16 REPLIES 16
Kurt_Bremser
Super User

Please post logs as text using this button:

Bildschirmfoto 2020-04-07 um 08.32.59.jpg

For SAS code, use the "little running man" right next to it.

 

You assign constant character values to variables start and label; I guess that you wanted to assign the values contained in the variables continent_id and continent_name, so remove the quotes around the variables names.

tarheel13
Rhodochrosite | Level 12

is continent id char or numeric? 

archita
Fluorite | Level 6
Hi continentid is numeric
tarheel13
Rhodochrosite | Level 12

hmm so why did you use $ then if it's a numeric variable? 

Reeza
Super User

contentID is not used in your format as shown. 

See my previous post. 

 


@archita wrote:
Hi continentid is numeric

 

Reeza
Super User

The CNTLIN data set, continent, was created incorrectly. 

 

For the start and label, it assigns only one value which will always map the VALUE continent_ID to the continent_name. I think you likely meant to refer to those as variables not constants. 

 

Remove the quotes around the variables. 

 

FYI - if you post a picture of your code we'll have to explain to you how to modify it. 

If you post the actual code, we can show the suggested changes. Post your code and log directly in the future, not an image. 

 


@archita wrote:

Hi all,

I am facing this issue. Please help me with the error.  I have a dataset named continent with 2 variables-continentid and continent name. I want to create a control input dataset named continent and store it in myfmt catalog  and use the format on continentid var.name of the format is continent

archita_0-1645874760691.png

 


 

 

tarheel13
Rhodochrosite | Level 12
data continent;
	length continentName $50;
	infile datalines truncover dlm='|';
	input continent_id continentName $;
	datalines;
	1|Asia
	2|Africa
	3|N. America
	4|S. America
	5|Antarctica
	6|Europe
	7|Australia
	;
run;

proc print data= continent;
run;

data outfmt(keep=start label fmtname);
	set continent(rename=(continent_id=start continentname=label));
	fmtname='continent';
run;

proc format library=work cntlin=outfmt;
run;

This should do it. next time post sample data as datalines. 

archita
Fluorite | Level 6
Hi , Thank you for the help.I am still getting the same error.
This is the error:-
27 proc format library=blib.myfmt cntlin=continent;
ERROR: For format CONTINENT, this range is repeated, or values overlap: .-..
28 quit;

NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 5 observations read from the data set WORK.CONTINENT.
NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds


tarheel13
Rhodochrosite | Level 12

you seem like you don't listen. people have tried to help you. we gave you multiple solutions and you still ignore our advice 😞 

archita
Fluorite | Level 6
I am sorry , dint do it deliberately ,missed some parts of code. THe code is now working . Thanks a lot.
tarheel13
Rhodochrosite | Level 12

once again, you are not listening. we told you what you have to change in your code. the reason you are getting errors is because you have not implemented the change...

archita
Fluorite | Level 6
Hi,I am sorry for the inconvenience, I missed the code so was not getting the results dint do deliberately. now its working.. thank you so much.
archita
Fluorite | Level 6
data continent;
set blib.continent;
keep fmtname start label;
fmtname='CONTINENT';
start='Continent_ID';
label='Continent_Name';
run;
proc format library=blib.myfmt cntlin=continent;
select CONTINENT;
run;

This the code I am running currently still getting same error 

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 16 replies
  • 2674 views
  • 6 likes
  • 4 in conversation