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".

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 446 views
  • 6 likes
  • 4 in conversation