make connections • share ideas • be inspired Vend dine data! Gert Nissen 5 måder til at vende dine data - Kolonner til rækker og omvendt Copyright © 2014, SAS Institute Inc. All rights reserved. 5 måder at vende dine data 1. proc transpose, Høj til bred 2. proc transpose, Bred til høj 3. data step array() 4. proc sql 5. proc summary Copyright © 2014, SAS Institute Inc. All rights reserved. Hvad er PROC TRANSPOSE ? Copyright © 2014, SAS Institute Inc. All rights reserved. Syntax Copyright © 2014, SAS Institute Inc. All rights reserved. 1: Høj til bred Copyright © 2014, SAS Institute Inc. All rights reserved. 2: Bred til høj Copyright © 2014, SAS Institute Inc. All rights reserved. 3: data step array data prdsale_bred; set prdsale; by country; array actualarray(12) m1-m12; retain m1-m12; if first.country then i=0; i+1; actualarray[i]=actual; if last.country then output; keep country m1-m12; rename m1=jan m2=feb m3=mar m4=apr m5=maj m6=jun m7=jul m8=aug m9=sep m10=okt m11=nov m12=dec; run; Copyright © 2014, SAS Institute Inc. All rights reserved. proc sql; 4: proc sql; select name , sum(case when sex='M' then weight else . end) as male_weight , sum(case when sex='F' then weight else . end) as female_weight from sashelp.class group by name; quit; Copyright © 2014, SAS Institute Inc. All rights reserved. 5: proc summary proc summary data=prdsale nway; class country; output out=country (drop=_:) idgroup(out[12] (actual)=); run; Copyright © 2014, SAS Institute Inc. All rights reserved. make connections • share ideas • be inspired Copyright © 2014, SAS Institute Inc. All rights reserved. Links til mere inspiration 1. KNOWLEDGE BASE / SAMPLES & SAS NOTES - 36 results for transpose 2. SAS Communities – 500+ indlæg om Transpose 3. Learn the Basics of Proc Transpose 4. Proc Transpose or How to Turn It Around 5. Visualizing PROC TRANSPOSE 6. Taming the PROC TRANSPOSE 7. An Animated Guide: Proc Transpose 8. Efficient “One-Row-per-Subject” Data Mart Construction for Data Mining 9. It's a Bird, It's a Plane, It's SQL Transpose! 10. Sample 44637: Double PROC TRANSPOSE method for reshaping your data set with multiple BY variables 11. Changing the Shape of Your Data: PROC TRANSPOSE vs. Arrays 12. Five Ways to Flip-Flop Your Data 13. An Introduction to Reshaping (TRANSPOSE) and Combining (MATCH-MERGE) SAS® Data Sets 14. SOME USES (AND HANDY ABUSES) OF PROC TRANSPOSE 15. The Dataset Diet 0 How to transform short and ‘fat’ into long and ‘thin’ 16. Implementing Excel Pivot Functionality in SAS® Software 17. Pivoting” a SAS dataset using proc transpose 18. Long-to-Wide: PROC TRANSPOSE vs Arrays vs PROC SUMMARY 19. Using The Transpose Transform in SAS Data Integration Studio 20. How to reshape data long to wide using proc transpose 21. PROC TRANSPOSE: How to Convert Variables(columns) into Observations(ROWS) and Observations(ROWS) into Variables(Columns) 22. Simplifying Effective Data Transformation Via PROC TRANSPOSE 23. Atypical Applications of Proc Transpose 24. Transposing Data Using PROC SUMMARY'S IDGROUP Option 25. Data Transposition with Proc Report 26. Turning the data around: PROC TRANSPOSE and alternative approaches Copyright © 2014, SAS Institute Inc. All rights reserved.
© Copyright 2024