BookmarkSubscribeRSS Feed
HeatherNewton
Quartz | Level 8
length
region $10.
segment $40.
long_run real_bad c
cv_95 cv_99 8.
cv_accuracy $6.;

what can c be here? constant? it does not look like be a var name

I try google and read sas doc, dont even know where to start..

 

please kindly assist thank.

3 REPLIES 3
japelin
Rhodochrosite | Level 12

Why don't you just submit it before googling it anyway?

Since it is described in the length statement, it is a space-separated declaration of a variable, or variables and lengths.

 

code:

data a;
length
region $10.
segment $40.
long_run real_bad c
cv_95 cv_99 8.
cv_accuracy $6.;
run;

proc contents;run;

results:

japelin_0-1646626512083.png

 

Tom
Super User Tom
Super User

The only strange things there are the poor formatting and the inclusion of periods in the length values.  The lengths of SAS variables are always integer so the decimal point is not needed.  Including it makes the lengths look like they are formats.  Formats are a totally different concept than length.

length region $10 segment $40 long_run real_bad c cv_95 cv_99 8 cv_accuracy $6;
ballardw
Super User

What makes you think C cannot be a variable name? The rules for basic variable names are 1) must start with a letter or the underscore character, 2) following characters have to be letters, digits or the underscore character. Since C starts with a letter that is enough as there are no other characters.

 

Since C here is numeric, it might be the C involved with physics, or any value you might want to assign a constant to somewhere in the code, or something else obvious to the coder.

 

While I might question the coding style that uses variables such as "______" that is still a valid variable name (or data set name for that matter).

 

Sometimes the names are very descriptive but not obvious to anyone else. From a class I took comes the variable twopi

Obvious name?

Maybe you have the mind that would make the not-obvious-to-me connection that the value is something near "2 times Pi".

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!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 376 views
  • 6 likes
  • 4 in conversation