SAS studio - formatting
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I am attempting to format variables in SAS studio which have been truncated due to the name being longer than 32 characters, when I attempt to format the variables in SAS studio it gives the warning 'this variable in uninitialized'. when I run the same code in SAS EG against the same excel document imported, the code works fine and formats the variable. Why would the same code in SAS studio not work?
code:
data test;
set test1;
format 'variable'n best12.;
run;
sas formatting
add a comment |
I am attempting to format variables in SAS studio which have been truncated due to the name being longer than 32 characters, when I attempt to format the variables in SAS studio it gives the warning 'this variable in uninitialized'. when I run the same code in SAS EG against the same excel document imported, the code works fine and formats the variable. Why would the same code in SAS studio not work?
code:
data test;
set test1;
format 'variable'n best12.;
run;
sas formatting
Your question is a little confusing. Are you talking about the names of the variables? In SAS names are limited to 32 characters. Or the values of the variables? In SAS there are two types of variables, fixed length strings and floating point numbers. A FORMAT in SAS is instructions on how to convert the value to strings, usually for presentation in reports. BEST is an example of such a format for numeric variables.
– Tom
Jan 3 at 16:30
Apologies Tom, reading that again I can see why it is confusing. SAS has truncated the variable names so I am attempting to format the truncated names using 'name'n (as there is white spaces in there also). When I format the variable as a test in EG from the format comma14 to best12 it works fine, copying the code into SAS studio gives the warning 'variable is uninitialized'
– J.stack
Jan 3 at 16:42
Make sure you are trying to use the variable name and not the label attached to it. PROC IMPORT might have to modify the column headers to create valid and/or unique variable names, but it will use the original column header as the label and many ways of looking at the SAS dataset will display the labels as the column headers instead of using the actual variable names.
– Tom
Jan 3 at 18:47
add a comment |
I am attempting to format variables in SAS studio which have been truncated due to the name being longer than 32 characters, when I attempt to format the variables in SAS studio it gives the warning 'this variable in uninitialized'. when I run the same code in SAS EG against the same excel document imported, the code works fine and formats the variable. Why would the same code in SAS studio not work?
code:
data test;
set test1;
format 'variable'n best12.;
run;
sas formatting
I am attempting to format variables in SAS studio which have been truncated due to the name being longer than 32 characters, when I attempt to format the variables in SAS studio it gives the warning 'this variable in uninitialized'. when I run the same code in SAS EG against the same excel document imported, the code works fine and formats the variable. Why would the same code in SAS studio not work?
code:
data test;
set test1;
format 'variable'n best12.;
run;
sas formatting
sas formatting
edited Jan 3 at 16:48
J.stack
asked Jan 3 at 16:22
J.stackJ.stack
113
113
Your question is a little confusing. Are you talking about the names of the variables? In SAS names are limited to 32 characters. Or the values of the variables? In SAS there are two types of variables, fixed length strings and floating point numbers. A FORMAT in SAS is instructions on how to convert the value to strings, usually for presentation in reports. BEST is an example of such a format for numeric variables.
– Tom
Jan 3 at 16:30
Apologies Tom, reading that again I can see why it is confusing. SAS has truncated the variable names so I am attempting to format the truncated names using 'name'n (as there is white spaces in there also). When I format the variable as a test in EG from the format comma14 to best12 it works fine, copying the code into SAS studio gives the warning 'variable is uninitialized'
– J.stack
Jan 3 at 16:42
Make sure you are trying to use the variable name and not the label attached to it. PROC IMPORT might have to modify the column headers to create valid and/or unique variable names, but it will use the original column header as the label and many ways of looking at the SAS dataset will display the labels as the column headers instead of using the actual variable names.
– Tom
Jan 3 at 18:47
add a comment |
Your question is a little confusing. Are you talking about the names of the variables? In SAS names are limited to 32 characters. Or the values of the variables? In SAS there are two types of variables, fixed length strings and floating point numbers. A FORMAT in SAS is instructions on how to convert the value to strings, usually for presentation in reports. BEST is an example of such a format for numeric variables.
– Tom
Jan 3 at 16:30
Apologies Tom, reading that again I can see why it is confusing. SAS has truncated the variable names so I am attempting to format the truncated names using 'name'n (as there is white spaces in there also). When I format the variable as a test in EG from the format comma14 to best12 it works fine, copying the code into SAS studio gives the warning 'variable is uninitialized'
– J.stack
Jan 3 at 16:42
Make sure you are trying to use the variable name and not the label attached to it. PROC IMPORT might have to modify the column headers to create valid and/or unique variable names, but it will use the original column header as the label and many ways of looking at the SAS dataset will display the labels as the column headers instead of using the actual variable names.
– Tom
Jan 3 at 18:47
Your question is a little confusing. Are you talking about the names of the variables? In SAS names are limited to 32 characters. Or the values of the variables? In SAS there are two types of variables, fixed length strings and floating point numbers. A FORMAT in SAS is instructions on how to convert the value to strings, usually for presentation in reports. BEST is an example of such a format for numeric variables.
– Tom
Jan 3 at 16:30
Your question is a little confusing. Are you talking about the names of the variables? In SAS names are limited to 32 characters. Or the values of the variables? In SAS there are two types of variables, fixed length strings and floating point numbers. A FORMAT in SAS is instructions on how to convert the value to strings, usually for presentation in reports. BEST is an example of such a format for numeric variables.
– Tom
Jan 3 at 16:30
Apologies Tom, reading that again I can see why it is confusing. SAS has truncated the variable names so I am attempting to format the truncated names using 'name'n (as there is white spaces in there also). When I format the variable as a test in EG from the format comma14 to best12 it works fine, copying the code into SAS studio gives the warning 'variable is uninitialized'
– J.stack
Jan 3 at 16:42
Apologies Tom, reading that again I can see why it is confusing. SAS has truncated the variable names so I am attempting to format the truncated names using 'name'n (as there is white spaces in there also). When I format the variable as a test in EG from the format comma14 to best12 it works fine, copying the code into SAS studio gives the warning 'variable is uninitialized'
– J.stack
Jan 3 at 16:42
Make sure you are trying to use the variable name and not the label attached to it. PROC IMPORT might have to modify the column headers to create valid and/or unique variable names, but it will use the original column header as the label and many ways of looking at the SAS dataset will display the labels as the column headers instead of using the actual variable names.
– Tom
Jan 3 at 18:47
Make sure you are trying to use the variable name and not the label attached to it. PROC IMPORT might have to modify the column headers to create valid and/or unique variable names, but it will use the original column header as the label and many ways of looking at the SAS dataset will display the labels as the column headers instead of using the actual variable names.
– Tom
Jan 3 at 18:47
add a comment |
3 Answers
3
active
oldest
votes
Compare the value of option VALIDVARNAME in EG vs Studio. Set it in studio to the same as EG.
how do you view the value of validvarname? I can only see how you set it.
– J.stack
Jan 3 at 16:35
add a comment |
Two common ways to view the current setting of an option. Proc OPTIONS
or function GetOption
proc options option=validvarname;
run;
%put %sysfunc(getoption(validvarname));
add a comment |
The code won’t be the same because you’re using two different applications with different default settings most likely. As someone else indicated, it’s likely the validvarname option that’s the issue. I would recommend setting it to V7 which avoids these issues. With this setting, SAS converts them to valid variable names by default and you can avoid the rename step entirely.
Supposedly the 32 char limit will be lifted in SAS 9.5. No release date has been announced, SAS 9.4 M5 was recently released so I’m not expecting it super soon.
do you have a roadmap link showing what might be in 9.5 ?
– Richard
Jan 4 at 13:16
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54026113%2fsas-studio-formatting%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Compare the value of option VALIDVARNAME in EG vs Studio. Set it in studio to the same as EG.
how do you view the value of validvarname? I can only see how you set it.
– J.stack
Jan 3 at 16:35
add a comment |
Compare the value of option VALIDVARNAME in EG vs Studio. Set it in studio to the same as EG.
how do you view the value of validvarname? I can only see how you set it.
– J.stack
Jan 3 at 16:35
add a comment |
Compare the value of option VALIDVARNAME in EG vs Studio. Set it in studio to the same as EG.
Compare the value of option VALIDVARNAME in EG vs Studio. Set it in studio to the same as EG.
answered Jan 3 at 16:27
data _null_data _null_
5,572710
5,572710
how do you view the value of validvarname? I can only see how you set it.
– J.stack
Jan 3 at 16:35
add a comment |
how do you view the value of validvarname? I can only see how you set it.
– J.stack
Jan 3 at 16:35
how do you view the value of validvarname? I can only see how you set it.
– J.stack
Jan 3 at 16:35
how do you view the value of validvarname? I can only see how you set it.
– J.stack
Jan 3 at 16:35
add a comment |
Two common ways to view the current setting of an option. Proc OPTIONS
or function GetOption
proc options option=validvarname;
run;
%put %sysfunc(getoption(validvarname));
add a comment |
Two common ways to view the current setting of an option. Proc OPTIONS
or function GetOption
proc options option=validvarname;
run;
%put %sysfunc(getoption(validvarname));
add a comment |
Two common ways to view the current setting of an option. Proc OPTIONS
or function GetOption
proc options option=validvarname;
run;
%put %sysfunc(getoption(validvarname));
Two common ways to view the current setting of an option. Proc OPTIONS
or function GetOption
proc options option=validvarname;
run;
%put %sysfunc(getoption(validvarname));
answered Jan 3 at 18:42
RichardRichard
10.1k21329
10.1k21329
add a comment |
add a comment |
The code won’t be the same because you’re using two different applications with different default settings most likely. As someone else indicated, it’s likely the validvarname option that’s the issue. I would recommend setting it to V7 which avoids these issues. With this setting, SAS converts them to valid variable names by default and you can avoid the rename step entirely.
Supposedly the 32 char limit will be lifted in SAS 9.5. No release date has been announced, SAS 9.4 M5 was recently released so I’m not expecting it super soon.
do you have a roadmap link showing what might be in 9.5 ?
– Richard
Jan 4 at 13:16
add a comment |
The code won’t be the same because you’re using two different applications with different default settings most likely. As someone else indicated, it’s likely the validvarname option that’s the issue. I would recommend setting it to V7 which avoids these issues. With this setting, SAS converts them to valid variable names by default and you can avoid the rename step entirely.
Supposedly the 32 char limit will be lifted in SAS 9.5. No release date has been announced, SAS 9.4 M5 was recently released so I’m not expecting it super soon.
do you have a roadmap link showing what might be in 9.5 ?
– Richard
Jan 4 at 13:16
add a comment |
The code won’t be the same because you’re using two different applications with different default settings most likely. As someone else indicated, it’s likely the validvarname option that’s the issue. I would recommend setting it to V7 which avoids these issues. With this setting, SAS converts them to valid variable names by default and you can avoid the rename step entirely.
Supposedly the 32 char limit will be lifted in SAS 9.5. No release date has been announced, SAS 9.4 M5 was recently released so I’m not expecting it super soon.
The code won’t be the same because you’re using two different applications with different default settings most likely. As someone else indicated, it’s likely the validvarname option that’s the issue. I would recommend setting it to V7 which avoids these issues. With this setting, SAS converts them to valid variable names by default and you can avoid the rename step entirely.
Supposedly the 32 char limit will be lifted in SAS 9.5. No release date has been announced, SAS 9.4 M5 was recently released so I’m not expecting it super soon.
answered Jan 4 at 2:00
ReezaReeza
13.4k21227
13.4k21227
do you have a roadmap link showing what might be in 9.5 ?
– Richard
Jan 4 at 13:16
add a comment |
do you have a roadmap link showing what might be in 9.5 ?
– Richard
Jan 4 at 13:16
do you have a roadmap link showing what might be in 9.5 ?
– Richard
Jan 4 at 13:16
do you have a roadmap link showing what might be in 9.5 ?
– Richard
Jan 4 at 13:16
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54026113%2fsas-studio-formatting%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Your question is a little confusing. Are you talking about the names of the variables? In SAS names are limited to 32 characters. Or the values of the variables? In SAS there are two types of variables, fixed length strings and floating point numbers. A FORMAT in SAS is instructions on how to convert the value to strings, usually for presentation in reports. BEST is an example of such a format for numeric variables.
– Tom
Jan 3 at 16:30
Apologies Tom, reading that again I can see why it is confusing. SAS has truncated the variable names so I am attempting to format the truncated names using 'name'n (as there is white spaces in there also). When I format the variable as a test in EG from the format comma14 to best12 it works fine, copying the code into SAS studio gives the warning 'variable is uninitialized'
– J.stack
Jan 3 at 16:42
Make sure you are trying to use the variable name and not the label attached to it. PROC IMPORT might have to modify the column headers to create valid and/or unique variable names, but it will use the original column header as the label and many ways of looking at the SAS dataset will display the labels as the column headers instead of using the actual variable names.
– Tom
Jan 3 at 18:47