BookmarkSubscribeRSS Feed
Jannie_D
Calcite | Level 5

I have a very big data set on a secure server, hence I can not copy paste codes og logs.

I have no been spending days trying to apply on my predefined codes. so What i did so far:

 

libname fmt "path...";

options fmtsearch=(fmt.uddannelser fmt.diced);

 

proc format;

value audd_niveau_L1L2_KT

0="90 uoplyst" 

1="10 grundskole"

....goes on for several 100 lines.....;

run;

data udda1

set udda;

format hfaudd default= audd_niveau_L1L2_Kt;

run;

 

but it do not work what do I do?

 

3 REPLIES 3
Kurt_Bremser
Super User

Look at the log (Maxim 2). The FORMAT statement does not need an equal sign, and actually rejects it.

 

PS get an account on SAS on Demand for Academics. There you can recreate code that causes problems and copy/paste code and logs without restrictions.

 

PaigeMiller
Diamond | Level 26

The only thing I see wrong is in the FORMAT statement.

 

The syntax of the format statement is:

 

FORMAT variablename formatname. ;

 

Note, there must be a dot at the end of the formatname. There is no equal sign.

 

If you fix that and it still doesn't work, show us the LOG of this DATA step so we can see both your code that is being used and the exact ERROR message. Do not chop out parts of the LOG for this DATA step, we need to see it verbatim, copied as text and pasted into the window that appears when you click on the </> icon. This preserves the formatting and makes the log more readable — do not provide the log any other way.

--
Paige Miller
Reeza
Super User
You don't indicate what you mean by 'predefined' formats. If you mean that you have a format for a variable name and need to apply them, if they're listed in a data set that can be automated. If there's a pattern it can also be automated. And if you have a lookup file that has the original & new values you can also automate the creation of the format.

This paper is a good read on formats IMO.
https://support.sas.com/resources/papers/proceedings/proceedings/sugi30/001-30.pdf

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 413 views
  • 4 likes
  • 4 in conversation