SAS studio - formatting





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















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;










share|improve this question

























  • 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




















0















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;










share|improve this question

























  • 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
















0












0








0








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;










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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





















  • 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














3 Answers
3






active

oldest

votes


















1














Compare the value of option VALIDVARNAME in EG vs Studio. Set it in studio to the same as EG.






share|improve this answer
























  • how do you view the value of validvarname? I can only see how you set it.

    – J.stack
    Jan 3 at 16:35



















1














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));





share|improve this answer































    0














    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.






    share|improve this answer
























    • do you have a roadmap link showing what might be in 9.5 ?

      – Richard
      Jan 4 at 13:16












    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    1














    Compare the value of option VALIDVARNAME in EG vs Studio. Set it in studio to the same as EG.






    share|improve this answer
























    • how do you view the value of validvarname? I can only see how you set it.

      – J.stack
      Jan 3 at 16:35
















    1














    Compare the value of option VALIDVARNAME in EG vs Studio. Set it in studio to the same as EG.






    share|improve this answer
























    • how do you view the value of validvarname? I can only see how you set it.

      – J.stack
      Jan 3 at 16:35














    1












    1








    1







    Compare the value of option VALIDVARNAME in EG vs Studio. Set it in studio to the same as EG.






    share|improve this answer













    Compare the value of option VALIDVARNAME in EG vs Studio. Set it in studio to the same as EG.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    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



















    • 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













    1














    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));





    share|improve this answer




























      1














      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));





      share|improve this answer


























        1












        1








        1







        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));





        share|improve this answer













        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));






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 3 at 18:42









        RichardRichard

        10.1k21329




        10.1k21329























            0














            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.






            share|improve this answer
























            • do you have a roadmap link showing what might be in 9.5 ?

              – Richard
              Jan 4 at 13:16
















            0














            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.






            share|improve this answer
























            • do you have a roadmap link showing what might be in 9.5 ?

              – Richard
              Jan 4 at 13:16














            0












            0








            0







            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.






            share|improve this answer













            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.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            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



















            • 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


















            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

            Does disintegrating a polymorphed enemy still kill it after the 2018 errata?

            A Topological Invariant for $pi_3(U(n))$