Use of : when reading multiple records in SAS











up vote
2
down vote

favorite












I am studying SAS programming and there is one thing that is puzzling me. I tried to look up what colons (:) do in the text book I am using but I could not find anything.



The following program was one of the questions, and with the colon the program does read the instream data but without the colons it reads funny.



I am suspecting that the length of ABRAMS is less than 12 and that is why it reads it inappropriately, but with the colon for some reason it recognizes is fine.



I appreciate your help.



data a;
input #1 Lname $ Fname $ /
Department : $12. Salary : comma.10;
cards;
ABRAMS THOMAS
SALES $25,209.03
;
run;

proc print;
run;









share|improve this question


























    up vote
    2
    down vote

    favorite












    I am studying SAS programming and there is one thing that is puzzling me. I tried to look up what colons (:) do in the text book I am using but I could not find anything.



    The following program was one of the questions, and with the colon the program does read the instream data but without the colons it reads funny.



    I am suspecting that the length of ABRAMS is less than 12 and that is why it reads it inappropriately, but with the colon for some reason it recognizes is fine.



    I appreciate your help.



    data a;
    input #1 Lname $ Fname $ /
    Department : $12. Salary : comma.10;
    cards;
    ABRAMS THOMAS
    SALES $25,209.03
    ;
    run;

    proc print;
    run;









    share|improve this question
























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I am studying SAS programming and there is one thing that is puzzling me. I tried to look up what colons (:) do in the text book I am using but I could not find anything.



      The following program was one of the questions, and with the colon the program does read the instream data but without the colons it reads funny.



      I am suspecting that the length of ABRAMS is less than 12 and that is why it reads it inappropriately, but with the colon for some reason it recognizes is fine.



      I appreciate your help.



      data a;
      input #1 Lname $ Fname $ /
      Department : $12. Salary : comma.10;
      cards;
      ABRAMS THOMAS
      SALES $25,209.03
      ;
      run;

      proc print;
      run;









      share|improve this question













      I am studying SAS programming and there is one thing that is puzzling me. I tried to look up what colons (:) do in the text book I am using but I could not find anything.



      The following program was one of the questions, and with the colon the program does read the instream data but without the colons it reads funny.



      I am suspecting that the length of ABRAMS is less than 12 and that is why it reads it inappropriately, but with the colon for some reason it recognizes is fine.



      I appreciate your help.



      data a;
      input #1 Lname $ Fname $ /
      Department : $12. Salary : comma.10;
      cards;
      ABRAMS THOMAS
      SALES $25,209.03
      ;
      run;

      proc print;
      run;






      sas






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 at 7:10









      hyg17

      1638




      1638
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          5
          down vote



          accepted










          Have a look at the documentation for the input statement. There is admittedly quite a lot of it, so here's a link to the specific page that deals with this:



          http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000144370.htm



          Relevant quote:




          :



          enables you to specify an informat that the INPUT statement uses to
          read the variable value. For a character variable, this format
          modifier reads the value from the next non-blank column until the
          pointer reaches the next blank column, the defined length of the
          variable, or the end of the data line, whichever comes first. For a
          numeric variable, this format modifier reads the value from the next
          non-blank column until the pointer reaches the next blank column or
          the end of the data line, whichever comes first.







          share|improve this answer





















          • Thank you! That was very helpful.
            – hyg17
            Nov 13 at 21:50











          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',
          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%2f53275637%2fuse-of-when-reading-multiple-records-in-sas%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          5
          down vote



          accepted










          Have a look at the documentation for the input statement. There is admittedly quite a lot of it, so here's a link to the specific page that deals with this:



          http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000144370.htm



          Relevant quote:




          :



          enables you to specify an informat that the INPUT statement uses to
          read the variable value. For a character variable, this format
          modifier reads the value from the next non-blank column until the
          pointer reaches the next blank column, the defined length of the
          variable, or the end of the data line, whichever comes first. For a
          numeric variable, this format modifier reads the value from the next
          non-blank column until the pointer reaches the next blank column or
          the end of the data line, whichever comes first.







          share|improve this answer





















          • Thank you! That was very helpful.
            – hyg17
            Nov 13 at 21:50















          up vote
          5
          down vote



          accepted










          Have a look at the documentation for the input statement. There is admittedly quite a lot of it, so here's a link to the specific page that deals with this:



          http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000144370.htm



          Relevant quote:




          :



          enables you to specify an informat that the INPUT statement uses to
          read the variable value. For a character variable, this format
          modifier reads the value from the next non-blank column until the
          pointer reaches the next blank column, the defined length of the
          variable, or the end of the data line, whichever comes first. For a
          numeric variable, this format modifier reads the value from the next
          non-blank column until the pointer reaches the next blank column or
          the end of the data line, whichever comes first.







          share|improve this answer





















          • Thank you! That was very helpful.
            – hyg17
            Nov 13 at 21:50













          up vote
          5
          down vote



          accepted







          up vote
          5
          down vote



          accepted






          Have a look at the documentation for the input statement. There is admittedly quite a lot of it, so here's a link to the specific page that deals with this:



          http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000144370.htm



          Relevant quote:




          :



          enables you to specify an informat that the INPUT statement uses to
          read the variable value. For a character variable, this format
          modifier reads the value from the next non-blank column until the
          pointer reaches the next blank column, the defined length of the
          variable, or the end of the data line, whichever comes first. For a
          numeric variable, this format modifier reads the value from the next
          non-blank column until the pointer reaches the next blank column or
          the end of the data line, whichever comes first.







          share|improve this answer












          Have a look at the documentation for the input statement. There is admittedly quite a lot of it, so here's a link to the specific page that deals with this:



          http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000144370.htm



          Relevant quote:




          :



          enables you to specify an informat that the INPUT statement uses to
          read the variable value. For a character variable, this format
          modifier reads the value from the next non-blank column until the
          pointer reaches the next blank column, the defined length of the
          variable, or the end of the data line, whichever comes first. For a
          numeric variable, this format modifier reads the value from the next
          non-blank column until the pointer reaches the next blank column or
          the end of the data line, whichever comes first.








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 at 10:07









          user667489

          7,72721226




          7,72721226












          • Thank you! That was very helpful.
            – hyg17
            Nov 13 at 21:50


















          • Thank you! That was very helpful.
            – hyg17
            Nov 13 at 21:50
















          Thank you! That was very helpful.
          – hyg17
          Nov 13 at 21:50




          Thank you! That was very helpful.
          – hyg17
          Nov 13 at 21:50


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53275637%2fuse-of-when-reading-multiple-records-in-sas%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

          How to change which sound is reproduced for terminal bell?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

          Can I use Tabulator js library in my java Spring + Thymeleaf project?