BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
NewUsrStat
Lapis Lazuli | Level 10

Hi everyone,

I'm working with data that require the adoption of CDISC standards.

 

Among the rules, I have to assign specific formats to variables.

 

For example, in the DM domain I have to assign the variable "ARMNRS" the format (ARMNULRS). To do this, I use: proc format $ARMNULRS etc. The variable ARMNRS must be character.

 

While exporting the dataset in XPT format (I have to do this; there is no option to export in .sas format), the $ARMNULRS format name is too long. A maximum of 8 characters is allowed, and the $ is included in the count.

 

I tried using options validvarname=v6, but it did not help.

Is there a way to prevent SAS from counting $ as a character?

Note that:

1) I cannot shorten the format name because of standards.
2) I have to format the variable again because of standards and therefore I cannot use: if x then value = "xxx".

 

Here is the PROC FORMAT code for that variable:

 

proc format;	
value $ARMNULRS (notsorted multilabel)
	"Assigned, Not Treated"	=	"Assigned, Not Treated"
	"Not Assigned"	        =	"Not Assigned"
	"Failure to Meet Inclusion/Exclusion Criteria"	=	"Screen Failure"
	"Screening Not Completed"	=	"Screening Not Completed"
	"Unplanned Treatment"	=	"Unplanned Treatment";
run;

Thank you in advance

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

If you use the XPORT library engine to make the transport file then the dataset must follow SAS Version 5 standards.  So member names and variable names must be 8 bytes or less. Character variable lengths must be 200 bytes or less.  And format names must be 8 bytes or less, including the required $ prefix on a character format.

 

You could make a SAS Version 9 standard transport file instead by using the %LOC2XPT() macro that SAS provides.

View solution in original post

3 REPLIES 3
Tom
Super User Tom
Super User

If you use the XPORT library engine to make the transport file then the dataset must follow SAS Version 5 standards.  So member names and variable names must be 8 bytes or less. Character variable lengths must be 200 bytes or less.  And format names must be 8 bytes or less, including the required $ prefix on a character format.

 

You could make a SAS Version 9 standard transport file instead by using the %LOC2XPT() macro that SAS provides.

Tom
Super User Tom
Super User

Since the FORMAT is not actually transforming the data why do you need it?

And since the name of the variable is only 6 bytes long why not just use the same name for the FORMAT as you did for the VARIABLE?

 

Xyverix2
Calcite | Level 5

@NewUsrStat wrote:

Hi everyone,

I'm working with data that require the adoption of CDISC standards.

 

Among the rules, I have to assign specific formats to variables.

 

For example, in the DM domain I have to assign the variable "ARMNRS" the format (ARMNULRS). To do this, I use: proc format $ARMNULRS etc. The variable ARMNRS must be character.

 

kinda reminds me how analytics and probability feel a lot like a casino game sometimes. When you’re digging into data patterns in SAS, it’s almost like playing poker or blackjack — you read signals, calculate odds, and hope your “bet” on a model pays off. The whole idea of risk vs reward is super similar to gambling logic, just with numbers instead of chips.

I’ve actually been exploring how people manage money strategies in gaming environments, and it’s wild how much crossover there is with data-driven decision making. Stuff like bankroll management or understanding payout structures can be compared to optimizing resources in analytics workflows.

By the way, if anyone here is curious about how modern platforms handle transactions and payouts, I found a pretty solid breakdown at JeetCity casino payments which goes deep into methods, speed, and reliability — honestly useful even beyond casino talk.

Cool to see how different fields connect when you look at them from another angle.

 

While exporting the dataset in XPT format (I have to do this; there is no option to export in .sas format), the $ARMNULRS format name is too long. A maximum of 8 characters is allowed, and the $ is included in the count.

 

I tried using options validvarname=v6, but it did not help.

Is there a way to prevent SAS from counting $ as a character?

Note that:

1) I cannot shorten the format name because of standards.
2) I have to format the variable again because of standards and therefore I cannot use: if x then value = "xxx".

 

Here is the PROC FORMAT code for that variable:

 

proc format;	
value $ARMNULRS (notsorted multilabel)
	"Assigned, Not Treated"	=	"Assigned, Not Treated"
	"Not Assigned"	        =	"Not Assigned"
	"Failure to Meet Inclusion/Exclusion Criteria"	=	"Screen Failure"
	"Screening Not Completed"	=	"Screening Not Completed"
	"Unplanned Treatment"	=	"Unplanned Treatment";
run;

Thank you in advance

 

 


Yeah this usually comes down to a mismatch between the variable type and the format you’re defining. If SAS is treating it as character, it’s because it is character at that point. Then when you try to use ranges, SAS compares them as text, not numbers, which gives odd results. So the fix is pretty straightforward: either stick with character and define the format using explicit values (quoted), or convert the variable to numeric first and then use numeric ranges in your format Most people just convert to numeric and move on, since that’s what PROC FORMAT handles more naturally with ranges. Also worth checking if the variable was read in as character accidentally (like from CSV or Excel), that’s a common cause.

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore Now →
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
  • 400 views
  • 3 likes
  • 3 in conversation