Solved

checking the length of text field less than or equal to the assigned macro  - SAS

Posted on 2014-01-27
1
430 Views
Last Modified: 2016-02-10
I am building a text field based on variables coming in from a list.
I have created the macro below

Data _null_;
call symput("format_textrecord", '$10000.');  /*Setup variable for textrecord length */
run;

Once the textrecord is built through processing, I would like to check the length of the textrecord field to ensure that it is less than 10000.

Is there a way to do this using the macro variable.  I know this can be done by hardcoding 10000 in an if statement, but I want to avoid as much manual interaction as possible so that the check and the format stay iin sync.
0
Comment
Question by:morinia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 14

Accepted Solution

by:
Aloysius Low earned 500 total points
ID: 39811981
I'm not understanding what you wish to check against what so taking a stab here

You can store the max length permissible in a macro variable, then use sashelp.vcolumn do a query to check length the field (can't recall field name but probably is LENGTH) by filtering by LIBNAME = library where table is stored AND MEMNAME = table name AND NAME = column name
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SAS-like access for a SQL Blob field 8 53
How to specify a range for string characters? 10 144
Sub-setting a table in SAS 3 81
Stat question 5 99
Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question