BookmarkSubscribeRSS Feed
R_Win
Calcite | Level 5
Hi

I am having 90 character variable in a dataset now i want to find the length of all the variables.

How can i do it by using macros and how can i pass them
2 REPLIES 2
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Do you want to know the SAS "defined" LENGTH attribute or the "data value" internal length for your variables - big difference.

Scott Barry
SBBWorks, Inc.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Explore using the SAS-maintained DICTIONARY table information called COLUMNS (or SAS view SASHELP.VCOLUMN) to get the SAS variable names and associated LENGTH information. You can use this information to generate and execute SAS code on-the-fly.

Scott Barry
SBBWorks, Inc.

Programming with the SQL Procedure

Accessing SAS System Information by Using DICTIONARY Tables
http://support.sas.com/documentation/cdl/en/sqlproc/62086/HTML/default/a001385596.htm

Using Metadata and Project Data for Data-Driven Programming
Brian Varney, COMSYS IT Partners, Inc., Kalamazoo, Michigan
http://www2.sas.com/proceedings/sugi31/045-31.pdf

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1096 views
  • 0 likes
  • 2 in conversation